Transaction.data.transaction.transactions compatible with string type.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@
|
|||||||
*.key
|
*.key
|
||||||
sui.keystore.fortest
|
sui.keystore.fortest
|
||||||
/vendor/
|
/vendor/
|
||||||
|
.Ds_Store
|
||||||
|
|||||||
@@ -12,29 +12,29 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var ctx = context.Background()
|
var ctx = context.Background()
|
||||||
var cli = sui.NewSuiClient(constant.BvTestnetEndpoint)
|
var cli = sui.NewSuiClient(constant.BvMainnetEndpoint)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
SuiGetTotalTransactionBlocks()
|
//SuiGetTotalTransactionBlocks()
|
||||||
SuiGetTransactionBlock()
|
SuiGetTransactionBlock()
|
||||||
SuiMultiGetTransactionBlocks()
|
//SuiMultiGetTransactionBlocks()
|
||||||
SuiXQueryTransactionBlocks()
|
//SuiXQueryTransactionBlocks()
|
||||||
MoveCall()
|
//MoveCall()
|
||||||
MergeCoins()
|
//MergeCoins()
|
||||||
SplitCoin()
|
//SplitCoin()
|
||||||
SplitCoinEqual()
|
//SplitCoinEqual()
|
||||||
Publish()
|
//Publish()
|
||||||
TransferObject()
|
//TransferObject()
|
||||||
TransferSui()
|
//TransferSui()
|
||||||
Pay()
|
//Pay()
|
||||||
PaySui()
|
//PaySui()
|
||||||
PayAllSui()
|
//PayAllSui()
|
||||||
RequestAddStake()
|
//RequestAddStake()
|
||||||
RequestWithdrawStake()
|
//RequestWithdrawStake()
|
||||||
BatchTransaction()
|
//BatchTransaction()
|
||||||
SuiExecuteTransactionBlock()
|
//SuiExecuteTransactionBlock()
|
||||||
SuiDryRunTransactionBlock()
|
//SuiDryRunTransactionBlock()
|
||||||
SignAndExecuteTransactionBlock()
|
//SignAndExecuteTransactionBlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func SuiExecuteTransactionBlock() {
|
func SuiExecuteTransactionBlock() {
|
||||||
@@ -143,7 +143,7 @@ func SuiGetTotalTransactionBlocks() {
|
|||||||
|
|
||||||
func SuiGetTransactionBlock() {
|
func SuiGetTransactionBlock() {
|
||||||
rsp, err := cli.SuiGetTransactionBlock(ctx, models.SuiGetTransactionBlockRequest{
|
rsp, err := cli.SuiGetTransactionBlock(ctx, models.SuiGetTransactionBlockRequest{
|
||||||
Digest: "CeVpDXKKU3Gs89efej9pKiYYQyTzifE2BDxWwquUaUht",
|
Digest: "AhZYEiFFQtv5i1nLaURHiyvQNiyUBzNCHodnKFxgc2Lf",
|
||||||
Options: models.SuiTransactionBlockOptions{
|
Options: models.SuiTransactionBlockOptions{
|
||||||
ShowInput: true,
|
ShowInput: true,
|
||||||
ShowRawInput: true,
|
ShowRawInput: true,
|
||||||
|
|||||||
@@ -30,10 +30,22 @@ type SuiCallArg map[string]interface{}
|
|||||||
type SuiTransactionBlockKind struct {
|
type SuiTransactionBlockKind struct {
|
||||||
Kind string `json:"kind"`
|
Kind string `json:"kind"`
|
||||||
Inputs []SuiCallArg `json:"inputs"`
|
Inputs []SuiCallArg `json:"inputs"`
|
||||||
Transactions []SuiTransaction `json:"transactions"`
|
Transactions []any `json:"transactions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuiTransaction struct {
|
func MoveCall(data any) *MoveCallSuiTransaction {
|
||||||
|
bs, _ := json.Marshal(data)
|
||||||
|
res := gjson.GetBytes(bs, "MoveCall").Raw
|
||||||
|
|
||||||
|
if res != "" {
|
||||||
|
var data *MoveCallSuiTransaction
|
||||||
|
_ = json.Unmarshal([]byte(res), &data)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SuiTransactionEnum struct {
|
||||||
MakeMoveVec []interface{} `json:"MakeMoveVec,omitempty"`
|
MakeMoveVec []interface{} `json:"MakeMoveVec,omitempty"`
|
||||||
MergeCoins []interface{} `json:"MergeCoins,omitempty"`
|
MergeCoins []interface{} `json:"MergeCoins,omitempty"`
|
||||||
SplitCoins []interface{} `json:"SplitCoins,omitempty"`
|
SplitCoins []interface{} `json:"SplitCoins,omitempty"`
|
||||||
@@ -44,7 +56,7 @@ type SuiTransaction struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProgrammableTransaction struct {
|
type ProgrammableTransaction struct {
|
||||||
Transactions []SuiTransaction `json:"transactions"`
|
Transactions []any `json:"transactions"`
|
||||||
Inputs []SuiCallArg `json:"inputs"`
|
Inputs []SuiCallArg `json:"inputs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user