Giter Club home page Giter Club logo

sui-go-sdk's People

Contributors

0xblockhash avatar 0xgohash avatar bvcrypto avatar fredliang44 avatar irongyii avatar jaydenlink avatar miancan avatar neoandersoninmatrix avatar netquery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sui-go-sdk's Issues

Add a standard client to the existing client

Is your feature request related to a problem? Please describe.

Adding an add-on to the standard client.
Example:

httpClient := &http.Client{
		Timeout: time.Second * 45,
                Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}
	}
cli = sui.NewSuiClientWithCustomClient("https://sui-mainnet-endpoint.blockvision.org/", httpClient)

and add ratelimiter
Example:
10 requests/sec

AccountAddressParseError

Hi, I need your help when I use the recent sdk that I met some problems. I called the MoveCall and failed. here is the err:

{"code":-32602,"message":"byte deserialization failed, cause by: AccountAddressParseError"}
image

Is there wrong with me?
pls, help and Thx~

Support Dynamic Structure for ParsedJson in SuiEventResponse

Issue Description:
The current implementation of the ParsedJson field in the SuiEventResponse struct restricts the flexibility of the library as it assumes a fixed structure for all events. However, in practice, different events may have varying JSON structures, leading to limited usability and making the library less versatile.

Proposed Solution:
To enhance the flexibility and versatility of the library, it would be beneficial to support a dynamic structure for the ParsedJson field in the SuiEventResponse struct. This can be achieved by using a more generic and flexible data type, such as map[string]interface{}, which allows for arbitrary JSON structures to be accommodated.

Expected Outcome:
By supporting a dynamic structure for the ParsedJson field, the sui-go-sdk library can be used in a wider range of scenarios where events have diverse JSON structures. This would make the library more adaptable and ensure its compatibility with different event types, increasing its usefulness for developers.

Steps to Reproduce (if applicable):
N/A

Additional Information (optional):
If there are any alternative approaches or considerations to address this issue, please feel free to discuss them here. Your insights and suggestions are highly appreciated.

MoveCall arguments fail to unmarshal GasCoin

Provide Your Environment

SDK v1.0.5

Describe the bug

Client is unable to unmarshal MoveCallSuiTransaction for Move calls that contain the argument GasCoin, for example this transaction on mainnet. The current type assumes that arguments will always either contain Input or Result, so the string GasCoin fails to unmarshal.

json: cannot unmarshal string into Go struct field MoveCallSuiTransaction.transaction.data.transaction.transactions.MoveCall.arguments of type struct { Input int "json:\"Input,omitempty\""; Result int "json:\"Result,omitempty\"" }

Steps or screenshots to reproduce the behavior

client := sui.NewSuiClient("https://fullnode.mainnet.sui.io:443")
_, err := client.SuiGetTransactionBlock(context.Background(), models.SuiGetTransactionBlockRequest{
    Digest: "62PMou5oXnS7eHEveHEJzBGZTAiEa7YMNDdKA58sb5wS",
    Options: models.SuiTransactionBlockOptions{
        ShowInput: true,
    },
})

if err != nil {
    panic(err)
}

Expected behavior

The type MoveSuiCallTransaction.Arguments is able to accept GasCoin as an argument, for example

type MoveCallSuiTransaction struct {
	Package       string   `json:"package"`
	Module        string   `json:"module"`
	Function      string   `json:"function"`
	TypeArguments []string `json:"type_arguments"`
+	Arguments     []interface{}
-	Arguments     []struct {
-	 	Input  int `json:"Input,omitempty"`
-	        Result int `json:"Result,omitempty"`
-	} `json:"arguments"`

}

Transactions in examples don't exist

Provide Your Environment

Macos

Describe the bug

The transactions provided in the examples/ are lost. Not sure wether in the beginning they are already invalid transactions, or they have been pruned on-chain

Steps or screenshots to reproduce the behavior

  1. go run main.go any example

Expected behavior

The result successfully showed

Additional context

Add any other context about the problem here.

is it supported vector<Coin<SUI>> arguments ?

Hi, I hope you can help me. I use MoveCall I need to input the Arg1(as like vector<Coin>) when I call the contract.
as the following picture:
image

I tried many times but I failed.
forward to your reply, thanks.

signature verification

import {useWallet} from '@suiet/wallet-kit'
import * as tweetnacl from 'tweetnacl'

function App() {
  const wallet = useWallet();

  async function handleSignMsg() {
    try {
      const msg = 'Hello world!'
      // convert string to Uint8Array 
      const msgBytes = new TextEncoder().encode(msg)
      
      // call wallet's signMessage function
      const result = await wallet.signMessage({
        message: msgBytes
      })
            // verify signature with publicKey and SignedMessage (params are all included in result)
      const verifyResult = await wallet.verifySignedMessage(result, wallet.account.publicKey)
      if (!verifyResult) {
        console.log('signMessage succeed, but verify signedMessage failed')
      } else {
        console.log('signMessage succeed, and verify signedMessage succeed!')
      }
    } catch (e) {
      console.error('signMessage failed', e)
    }
  }

  return (
    <button onClick={handleSignMsg}> Sign Message </button>
  )
}

The front end can use wallet.signMessage to sign the message and then use wallet.verifySignedMessage to verify it. So how do I verify the result of wallet.signMessage in go. The result given to me by the front end includes the following:

"message": "Hello world!",
"signature":"ACgj38Kr1bJU74jxiHPTDIIcxr9UG6WftgWol9iF6I3ai1NRWuob603NazIdJJ0qhP8U5yA67FbYbZb59dbqygK1rQTxoTF1RH+j0mc5ILiRdAW2jX2OKecqYuDbBFN0NQ=="

Websocket connection support

When will the published version support websocket connection?

When will the published version support websocket connection? Since the websocket examples and codes are shown in this repo, but are not supported in the published version

AccountAddressParseError

Hi, I need your help when I use the recent sdk that I met some problems. I called the GetAllCoins and failed. here is the err:

{"code":-32602,"message":"byte deserialization failed, cause by: AccountAddressParseError"} [recovered]

image

Is there wrong with me?
pls, help and Thx~

Can't let Gas field empty in MoveCall

Provide Your Environment

the latest

Describe the bug

When calling MoveCall, we should be able ignore the Gas field. In this way the fullnode should assign the proper gas object. But we met AccountAddressParseError in the current impl

Steps or screenshots to reproduce the behavior

rsp, err := cli.MoveCall(ctx, models.MoveCallRequest{
		Signer:          account.Address,
		PackageObjectId: "d9b08c0d6ae77a37074d5bd53ac58da86a479f462037606346f2a7c3204f165f",
		Module:          "object_basics",
		Function:        "create",
		TypeArguments:   []interface{}{},
		Arguments: []interface{}{
			123,
			account.Address,
		},
		GasBudget: "100000000",
	})

Expected behavior

A clear and concise description of what you expected to happen.

Additional context

Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.