feat: test submit tx
This commit is contained in:
parent
e34c2738d0
commit
f91d39b943
@ -428,21 +428,29 @@ func TestFullFlow(t *testing.T) {
|
||||
|
||||
// This test should be run with timeout 300s
|
||||
func TestCreateTx(t *testing.T) {
|
||||
seed1 := "pledge vessel toilet sunny hockey skirt spend wire disorder attitude crumble lecture problem bundle bone rather address over suit ancient primary gospel silent repair"
|
||||
seed1 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
|
||||
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("masterKey1: ", base58.Encode(masterKey1.PublicKey))
|
||||
|
||||
seed2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
seed2 := "chimney endorse scan ramp cheap harvest mother ball winter way barrel foil tissue pupil answer worth right undo one chimney element grape image unlock"
|
||||
masterKey2, err := crypto.MasterKeyFromSeed(seed2)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("masterKey2", base58.Encode(masterKey2.PublicKey))
|
||||
|
||||
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||
assert.NoError(t, err)
|
||||
handler := wallet.NewGprcHandler(*nc)
|
||||
|
||||
inputs := "[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 91z5muQKgHZDcChdnCSTEtvuN8dbbXp5wzNs5xrCkce2YvSX1q6fu3d],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 3a9VWigUM1TuS79yM4dAqkiUg6WJMUPGwVKJpQUHCLJcFZsCWM2q6pF],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 9RkPvHMtuYtjV2qvB86u7zcnr26SdVcKzFnHgfhUSEG1W3FgKgLpbBm]"
|
||||
recipients := fmt.Sprintf("%s,%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey))
|
||||
gifts := "100,100,100"
|
||||
//inputs := "[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 91z5muQKgHZDcChdnCSTEtvuN8dbbXp5wzNs5xrCkce2YvSX1q6fu3d],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 3a9VWigUM1TuS79yM4dAqkiUg6WJMUPGwVKJpQUHCLJcFZsCWM2q6pF],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 9RkPvHMtuYtjV2qvB86u7zcnr26SdVcKzFnHgfhUSEG1W3FgKgLpbBm]"
|
||||
//inputs := "[7PGL7VUMmBBFLxBta9hxJy2yyPNyWww6mXB4B7L78CEM7vu8E1gZY6B 76WR3YEgKaPXN9YshstDhHo82yg7ghJwoYGy9hVoihdSogAMpb9Jbyb],[7PGL7VUMmBBFLxBta9hxJy2yyPNyWww6mXB4B7L78CEM7vu8E1gZY6B 4h3Y3RPn5oAuHEmVtysyxNfJgUiy1DsjfRn4GzgZvM7asPPgJ6Jb7iy]"
|
||||
//inputs := "[7PGL7VUMmBBFLxBta9hxJy2yyPNyWww6mXB4B7L78CEM7vu8E1gZY6B 76WR3YEgKaPXN9YshstDhHo82yg7ghJwoYGy9hVoihdSogAMpb9Jbyb],[7PGL7VUMmBBFLxBta9hxJy2yyPNyWww6mXB4B7L78CEM7vu8E1gZY6B 4h3Y3RPn5oAuHEmVtysyxNfJgUiy1DsjfRn4GzgZvM7asPPgJ6Jb7iy]"
|
||||
inputs := "[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 AmSjC3SDNtb7ZrUkTXc242BvGeimeL1nAV4CqV63HpLMryhom4L9W59],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 jH4hX8h69qfBKfCnx41da6bk8oU7NtirBuDgnPvtJ6SXoh6t2Fap2S]"
|
||||
//inputs := "[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 4d5zzcHuc9spJ1k3ozKYc4SyGm3APeN8wjsg5RkN27FaFsa7oMoJCDf],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 5ZgFvf8qt8YCa2Nru2VZG2FF7P82Xcj4EsM2EQKiddQ8C43ciG91276]"
|
||||
recipients := fmt.Sprintf("%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey))
|
||||
//recipients := "37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe,37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe" //fmt.Sprintf("%s", base58.Encode(masterKey2.PublicKey))
|
||||
gifts := "100,100"
|
||||
fee := 100
|
||||
|
||||
req := &nockchain.CreateTxRequest{
|
||||
@ -462,5 +470,20 @@ func TestCreateTx(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// the result is taken from create-tx scripts
|
||||
assert.Equal(t, res.RawTx.TxId, "8gjTa6H1MrKXPWgNJCF9fsYE7PUfqhYzxetUoTftz7zyHCv24ZYHDM3")
|
||||
//assert.Equal(t, res.RawTx.TxId, "8gjTa6H1MrKXPWgNJCF9fsYE7PUfqhYzxetUoTftz7zyHCv24ZYHDM3")
|
||||
|
||||
_, err = nc.WalletSendTransaction(res.RawTx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
txAccepted, err := nc.TxAccepted(res.RawTx.TxId)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("tx pass: ", res.RawTx.TxId)
|
||||
if !txAccepted.GetAccepted() {
|
||||
panic("tx not accepted")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user