block-vision / sui-go-sdk Goto Github PK
View Code? Open in Web Editor NEWGo language SDK for @MystenLabs Sui
License: Apache License 2.0
Go language SDK for @MystenLabs Sui
License: Apache License 2.0
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
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
Is this sdk support get test SUI tokens from faucet?
I want to get test SUI tokens from faucet for some address, is there a method in this sdk can achieve this?
How to get the tx's digest when SignSerializedSigWith before broadcast transaction?
Provide Your Environment
all
Describe the bug
Hey folks, I see new things are being merged to main, including important fixes, but new versions/tags are not being generated.
E.g latest one was in October 2013.
Is it possible to generate new versions/releases when merging things to main? Thank you!
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"`
}
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
Expected behavior
The result successfully showed
Additional context
Add any other context about the problem here.
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=="
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.
May I ask if there are some instructions or documents on constructing and using PTB (Programmable Transaction Blocks) with this sdk? I need to construct and use PTB which may contains a lot of transactions, but cannot find instructions on it with this sdk.
When gas is not filled in, an AccountAddressParseError error will occur. I think this bug should be the same as movecall
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.