Sign Amino

A web application may also request Adena to sign and send the transaction without broadcasting it directly on Adena via the Sign method. Upon receiving the request, Adena will prompt the user to sign the transaction.

If the user proceeds to sign the transaction, Adena will return the signed transaction data on the console for the web application to broadcast it by itself.

Code

adena.Sign({
    messages: [
        {
            type: "string",
            value: object
        },
        // you may add additional messages within the brackets
        ...
    ],
    gasFee: number,
    gasWanted: number,
    memo?: string
})

Params

KeyTypeDescription

message.type

string

"/bank.MsgSend" for transfers

"/vm.m_call" for contract calls "/vm.m_addpkg" for adding packages "/vm.m_run" for simulating transactions

message.value

object

Values (must match the type's format)

gasFee

number

Actual network fee to pay in ugnot

gasWanted

number

Gas limit

memo

string

Transaction memo (tag)

Response

KeyTypeDescription

code

number

Account number

status

string

Returns success or failure

type

string

Response type

message

string

Descriptive message of the result

data

object

Signed Amino Model

Signed Amino Model

KeyTypeDescription

signed

StdSignDoc

Signed transaction document

signature

StdSignature

Signature

checkTx

object

Only returns on successful transactions

deliverTx

object

Only returns on successful transactions

/bank.MsgSend

Sample Request

await adena.Sign(
  {
    messages: [{
        type: "/bank.MsgSend",
        value: {
            from_address: "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae", // your address
            to_address: "g122n67es9vzs0rmharsggfr4sdkd45aysnuzf7m", // recipient's address
            amount: "5000000ugnot" // sending amount. 1GNOT = 1000000ugnot
        }
    }],
    gasFee: 1,
    gasWanted: 1000000,
    memo: "12313"
  }
)

Sample Response

{
  "code": 0,
  "status": "success",
  "type": "SIGN_SUCCESS",
  "message": "Signed data has been successfully returned.",
  "data": {
      "signed": {
          "msgs": [
              {
                  "type": "/bank.MsgSend",
                  "value": {
                      "from_address": "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae", // your Adena address
                      "to_address": "g122n67es9vzs0rmharsggfr4sdkd45aysnuzf7m", // sending address
                      "amount": "5000000ugnot"
                  }
              }
          ],
          "fee": {
              "amount": [
                  {
                      "amount": "1",
                      "denom": "ugnot"
                  }
              ],
              "gas": "1000000"
          },
          "chain_id": "test3",
          "memo": "12313",
          "account_number": "656760",
          "sequence": "177"
      },
      "signature": {
          "pub_key": {
              "type": "tendermint/PubKeySecp256k1",
              "value": "A09whvkfsR4pCSEYMMt/do4mD9Zf76Dzs9/kOirITiy0"
          },
          "signature": "rfEQWvD2aXEZsZyJ7JFxGNP0CWbMKdg+6RNULtZTMLwz3Yi+cNwYOMG5XYh10Gexj9rbpC3jI6s3ww0TyZx8mm=="
      }
  }
}

/vm.m_call

Sample Request

await adena.Sign(
  {
    messages: [{
      type: "/vm.m_call",
      value: {
        caller: "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae", // your Adena address
        send: "",
        pkg_path: "gno.land/r/demo/foo20", // Gnoland package path
        func: "Transfer", // Function name
        args: [ // Arguments
          "g122n67es9vzs0rmharsggfr4sdkd45aysnuzf7m",
          "1"
        ]
      }
    }
  ], 
    gasFee: 1,
    gasWanted: 10000000
  }
)

Sample Response

{
  "code": 0,
  "message": "Sign amino.",
  "type": "SIGN_AMINO",
  "status": "success",
  "data": {
    "document": {
      "msgs": [
        {
          "type": "/vm.m_call",
          "value": {
            "caller": "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae",
            "send": "",
            "pkg_path": "gno.land/r/demo/foo20",
            "func": "Transfer",
            "args": [
              "g122n67es9vzs0rmharsggfr4sdkd45aysnuzf7m",
              "1"
            ]
          }
        }
      ],
      "fee": {
        "amount": [
          {
            "amount": "1",
            "denom": "ugnot"
          }
        ],
        "gas": "10000000"
      },
      "chain_id": "test3",
      "memo": "",
      "account_number": "656760",
      "sequence": "307"
    },
    "signature": {
      "pub_key": {
        "type": "tendermint/PubKeySecp256k1",
        "value": "A09whvkfsR4pCSEYMMt/do4mD9Zf76Dzs9/kOirITiy0"
      },
      "signature": "2WQXvhmVZqR1+l/16CSDBxOQupQOXTZj6aCbYtXcnOQ37nn3xVGdpdUbgkK7pbigMea138pPm+onsYkfZv1MuA=="
    }
  }
}

/vm.m_addpkg

Sample Request

await adena.Sign({
  messages: [{
    type: "/vm.m_addpkg",
    value: {
      creator: "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae", // your Adena address
      deposit: "1ugnot", // amount of ugnot to deposit in the package (enter a blank or an amount above 1 ugnot)
      package: {
        name: "hello", // package name
        path: "gno.land/r/demo/hello", // package path (cannot be a duplicate from existing paths on Gnoland)
        files: [ // a list of files to deploy
          {
            name: "hello.gno", // file name
            body: "package hello\n\nfunc Hello() string {\n\treturn \"Hello() called\"\n}\n\nfunc Render() string {\n\treturn \"Render() called\"\n}", //file contents
          }
        ]
      }
    }
  }],
  gasFee: 1, 
  gasWanted: 2000000
});

Sample Response

{
  "code": 0,
  "message": "Sign amino.",
  "type": "SIGN_AMINO",
  "status": "success",
  "data": {
    "document": {
      "msgs": [
        {
          "type": "/vm.m_addpkg",
          "value": {
            "creator": "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae",
            "deposit": "1ugnot",
            "package": {
              "name": "hello",
              "path": "gno.land/r/demo/hello",
              "files": [
                {
                  "name": "hello.gno",
                  "body": "package hello\n\nfunc Hello() string {\n\treturn \"Hello() called\"\n}\n\nfunc Render() string {\n\treturn \"Render() called\"\n}"
                }
              ]
            }
          }
        }
      ],
      "fee": {
        "amount": [
          {
            "amount": "1",
            "denom": "ugnot"
          }
        ],
        "gas": "2000000"
      },
      "chain_id": "test3",
      "memo": "",
      "account_number": "656760",
      "sequence": "307"
    },
    "signature": {
      "pub_key": {
        "type": "tendermint/PubKeySecp256k1",
        "value": "A09whvkfsR4pCSEYMMt/do4mD9Zf76Dzs9/kOirITiy0"
      },
      "signature": "YkB/GmmTDIG9LUOoH44OWWeiyrafv6AI4a8AqKWM+KAZlgrFXP7DAmPl1yaR1ec0QfJ9RsTWV80Yn2JhpP/1QQ=="
    }
  }
}

/vm.m_run

Sample Request

await adena.Sign({
  messages: [{
    type: "/vm.m_run",
    value: {
      caller: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
      send: "",
      package: {
        name: "main",
        path: "gno.land/r/demo/main",
        files: [
          {
            name: "script.gno",
            body: "package main\n\nfunc Main() {\n\tprintln(\"HELLO WORLD\")\n}",
          }
        ]
      }
    }
  }],
  gasFee: 1, 
  gasWanted: 2000000
});

Sample Response

{
    "status": "success",
    "data": {
        "document": {
            "msgs": [
                {
                    "type": "/vm.m_run",
                    "value": {
                        "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
                        "send": "",
                        "package": {
                            "name": "main",
                            "path": "gno.land/r/demo/main",
                            "files": [
                                {
                                    "name": "script.gno",
                                    "body": "package main\n\nfunc Main() {\n\tprintln(\"HELLO WORLD\")\n}"
                                }
                            ]
                        }
                    }
                }
            ],
            "fee": {
                "amount": [
                    {
                        "amount": "1",
                        "denom": "ugnot"
                    }
                ],
                "gas": "2000000"
            },
            "chain_id": "test3",
            "memo": "",
            "account_number": "3223",
            "sequence": "82"
        },
        "signature": {
            "pub_key": {
                "type": "tendermint/PubKeySecp256k1",
                "value": "A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"
            },
            "signature": "MYYWRnJ1OL2Q/QQFy7gzVNs2Rt0YrqWT9na1RnZv0+Qel3VCO01OsSiCqfy6O/In80lzNfPi4a/XeM+wB4JV0Q=="
        }
    },
    "code": 0,
    "message": "Sign Amino",
    "type": "SIGN_AMINO"
}

Last updated