@geeqdev/geeq-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/geeq_sdk.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.nvmrc +1 -0
- package/CONTRIBUTING.md +20 -0
- package/dist/src/address/record-type.d.ts +10 -0
- package/dist/src/address/record-type.js +59 -0
- package/dist/src/address/record-type.js.map +1 -0
- package/dist/src/address/wallet-address.d.ts +34 -0
- package/dist/src/address/wallet-address.js +90 -0
- package/dist/src/address/wallet-address.js.map +1 -0
- package/dist/src/amount.d.ts +43 -0
- package/dist/src/amount.js +105 -0
- package/dist/src/amount.js.map +1 -0
- package/dist/src/assert.d.ts +12 -0
- package/dist/src/assert.js +24 -0
- package/dist/src/assert.js.map +1 -0
- package/dist/src/capnp/adminNetTx.capnp.d.ts +75 -0
- package/dist/src/capnp/adminNetTx.capnp.js +66 -0
- package/dist/src/capnp/adminNetTx.capnp.js.map +1 -0
- package/dist/src/capnp/appLayBlock.capnp.d.ts +26 -0
- package/dist/src/capnp/appLayBlock.capnp.js +24 -0
- package/dist/src/capnp/appLayBlock.capnp.js.map +1 -0
- package/dist/src/capnp/appLayLedger.capnp.d.ts +34 -0
- package/dist/src/capnp/appLayLedger.capnp.js +32 -0
- package/dist/src/capnp/appLayLedger.capnp.js.map +1 -0
- package/dist/src/capnp/appLayRec.capnp.d.ts +129 -0
- package/dist/src/capnp/appLayRec.capnp.js +156 -0
- package/dist/src/capnp/appLayRec.capnp.js.map +1 -0
- package/dist/src/capnp/chainStateView.capnp.d.ts +50 -0
- package/dist/src/capnp/chainStateView.capnp.js +48 -0
- package/dist/src/capnp/chainStateView.capnp.js.map +1 -0
- package/dist/src/capnp/coinAcctRec.capnp.d.ts +178 -0
- package/dist/src/capnp/coinAcctRec.capnp.js +189 -0
- package/dist/src/capnp/coinAcctRec.capnp.js.map +1 -0
- package/dist/src/capnp/genesisBlock.capnp.d.ts +61 -0
- package/dist/src/capnp/genesisBlock.capnp.js +55 -0
- package/dist/src/capnp/genesisBlock.capnp.js.map +1 -0
- package/dist/src/capnp/hubContentStmt.capnp.d.ts +63 -0
- package/dist/src/capnp/hubContentStmt.capnp.js +57 -0
- package/dist/src/capnp/hubContentStmt.capnp.js.map +1 -0
- package/dist/src/capnp/misc.capnp.d.ts +20 -0
- package/dist/src/capnp/misc.capnp.js +18 -0
- package/dist/src/capnp/misc.capnp.js.map +1 -0
- package/dist/src/capnp/netActorRec.capnp.d.ts +65 -0
- package/dist/src/capnp/netActorRec.capnp.js +65 -0
- package/dist/src/capnp/netActorRec.capnp.js.map +1 -0
- package/dist/src/capnp/nodeContentStmt.capnp.d.ts +67 -0
- package/dist/src/capnp/nodeContentStmt.capnp.js +61 -0
- package/dist/src/capnp/nodeContentStmt.capnp.js.map +1 -0
- package/dist/src/capnp/nodePayloadList.capnp.d.ts +28 -0
- package/dist/src/capnp/nodePayloadList.capnp.js +26 -0
- package/dist/src/capnp/nodePayloadList.capnp.js.map +1 -0
- package/dist/src/capnp/nodeTxList.capnp.d.ts +36 -0
- package/dist/src/capnp/nodeTxList.capnp.js +34 -0
- package/dist/src/capnp/nodeTxList.capnp.js.map +1 -0
- package/dist/src/capnp/paramAcctRec.capnp.d.ts +338 -0
- package/dist/src/capnp/paramAcctRec.capnp.js +669 -0
- package/dist/src/capnp/paramAcctRec.capnp.js.map +1 -0
- package/dist/src/capnp/payload.capnp.d.ts +237 -0
- package/dist/src/capnp/payload.capnp.js +260 -0
- package/dist/src/capnp/payload.capnp.js.map +1 -0
- package/dist/src/capnp/proxyAcctRec.capnp.d.ts +223 -0
- package/dist/src/capnp/proxyAcctRec.capnp.js +255 -0
- package/dist/src/capnp/proxyAcctRec.capnp.js.map +1 -0
- package/dist/src/capnp/relayContentStmt.capnp.d.ts +82 -0
- package/dist/src/capnp/relayContentStmt.capnp.js +85 -0
- package/dist/src/capnp/relayContentStmt.capnp.js.map +1 -0
- package/dist/src/capnp/sysAcctRec.capnp.d.ts +48 -0
- package/dist/src/capnp/sysAcctRec.capnp.js +46 -0
- package/dist/src/capnp/sysAcctRec.capnp.js.map +1 -0
- package/dist/src/capnp/userAppTx.capnp.d.ts +230 -0
- package/dist/src/capnp/userAppTx.capnp.js +270 -0
- package/dist/src/capnp/userAppTx.capnp.js.map +1 -0
- package/dist/src/capnp/userValTx.capnp.d.ts +1575 -0
- package/dist/src/capnp/userValTx.capnp.js +2004 -0
- package/dist/src/capnp/userValTx.capnp.js.map +1 -0
- package/dist/src/capnp/valLayBlock.capnp.d.ts +88 -0
- package/dist/src/capnp/valLayBlock.capnp.js +86 -0
- package/dist/src/capnp/valLayBlock.capnp.js.map +1 -0
- package/dist/src/capnp/valLayLedger.capnp.d.ts +85 -0
- package/dist/src/capnp/valLayLedger.capnp.js +75 -0
- package/dist/src/capnp/valLayLedger.capnp.js.map +1 -0
- package/dist/src/chain/geeq-chain.d.ts +474 -0
- package/dist/src/chain/geeq-chain.js +721 -0
- package/dist/src/chain/geeq-chain.js.map +1 -0
- package/dist/src/chain/geeq-node.d.ts +57 -0
- package/dist/src/chain/geeq-node.js +62 -0
- package/dist/src/chain/geeq-node.js.map +1 -0
- package/dist/src/chain/nonce-guard.d.ts +42 -0
- package/dist/src/chain/nonce-guard.js +68 -0
- package/dist/src/chain/nonce-guard.js.map +1 -0
- package/dist/src/chain/select.d.ts +40 -0
- package/dist/src/chain/select.js +114 -0
- package/dist/src/chain/select.js.map +1 -0
- package/dist/src/crypto/account-id.d.ts +35 -0
- package/dist/src/crypto/account-id.js +58 -0
- package/dist/src/crypto/account-id.js.map +1 -0
- package/dist/src/crypto/keypair.d.ts +24 -0
- package/dist/src/crypto/keypair.js +158 -0
- package/dist/src/crypto/keypair.js.map +1 -0
- package/dist/src/crypto/mnemonic.d.ts +34 -0
- package/dist/src/crypto/mnemonic.js +57 -0
- package/dist/src/crypto/mnemonic.js.map +1 -0
- package/dist/src/encoding/base64.d.ts +8 -0
- package/dist/src/encoding/base64.js +53 -0
- package/dist/src/encoding/base64.js.map +1 -0
- package/dist/src/encoding/hex.d.ts +2 -0
- package/dist/src/encoding/hex.js +35 -0
- package/dist/src/encoding/hex.js.map +1 -0
- package/dist/src/errors.d.ts +83 -0
- package/dist/src/errors.js +49 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +59 -0
- package/dist/src/index.js +53 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ledger/coin-accounts.d.ts +42 -0
- package/dist/src/ledger/coin-accounts.js +37 -0
- package/dist/src/ledger/coin-accounts.js.map +1 -0
- package/dist/src/ledger/decode.d.ts +18 -0
- package/dist/src/ledger/decode.js +113 -0
- package/dist/src/ledger/decode.js.map +1 -0
- package/dist/src/ledger/geeq-ledger.d.ts +99 -0
- package/dist/src/ledger/geeq-ledger.js +125 -0
- package/dist/src/ledger/geeq-ledger.js.map +1 -0
- package/dist/src/ledger/net-actors.d.ts +65 -0
- package/dist/src/ledger/net-actors.js +53 -0
- package/dist/src/ledger/net-actors.js.map +1 -0
- package/dist/src/ledger/nft-records.d.ts +13 -0
- package/dist/src/ledger/nft-records.js +41 -0
- package/dist/src/ledger/nft-records.js.map +1 -0
- package/dist/src/ledger/params.d.ts +34 -0
- package/dist/src/ledger/params.js +71 -0
- package/dist/src/ledger/params.js.map +1 -0
- package/dist/src/ledger/proxy-accounts.d.ts +26 -0
- package/dist/src/ledger/proxy-accounts.js +27 -0
- package/dist/src/ledger/proxy-accounts.js.map +1 -0
- package/dist/src/net/discovery.d.ts +62 -0
- package/dist/src/net/discovery.js +136 -0
- package/dist/src/net/discovery.js.map +1 -0
- package/dist/src/net/explorer.d.ts +57 -0
- package/dist/src/net/explorer.js +64 -0
- package/dist/src/net/explorer.js.map +1 -0
- package/dist/src/net/read-ledger.d.ts +7 -0
- package/dist/src/net/read-ledger.js +39 -0
- package/dist/src/net/read-ledger.js.map +1 -0
- package/dist/src/net/routes.d.ts +49 -0
- package/dist/src/net/routes.js +70 -0
- package/dist/src/net/routes.js.map +1 -0
- package/dist/src/net/transport.d.ts +55 -0
- package/dist/src/net/transport.js +168 -0
- package/dist/src/net/transport.js.map +1 -0
- package/dist/src/net/websocket.d.ts +49 -0
- package/dist/src/net/websocket.js +54 -0
- package/dist/src/net/websocket.js.map +1 -0
- package/dist/src/runtime/bindings.d.ts +9 -0
- package/dist/src/runtime/bindings.js +27 -0
- package/dist/src/runtime/bindings.js.map +1 -0
- package/dist/src/runtime/init.d.ts +13 -0
- package/dist/src/runtime/init.js +40 -0
- package/dist/src/runtime/init.js.map +1 -0
- package/dist/src/runtime/wasm-loader.browser.d.ts +14 -0
- package/dist/src/runtime/wasm-loader.browser.js +20 -0
- package/dist/src/runtime/wasm-loader.browser.js.map +1 -0
- package/dist/src/runtime/wasm-loader.node.d.ts +7 -0
- package/dist/src/runtime/wasm-loader.node.js +14 -0
- package/dist/src/runtime/wasm-loader.node.js.map +1 -0
- package/dist/src/socket/geeq-socket.d.ts +232 -0
- package/dist/src/socket/geeq-socket.js +634 -0
- package/dist/src/socket/geeq-socket.js.map +1 -0
- package/dist/src/socket/tracked-tx.d.ts +148 -0
- package/dist/src/socket/tracked-tx.js +212 -0
- package/dist/src/socket/tracked-tx.js.map +1 -0
- package/dist/src/socket/tx-status.d.ts +69 -0
- package/dist/src/socket/tx-status.js +72 -0
- package/dist/src/socket/tx-status.js.map +1 -0
- package/dist/src/tx/attestation.d.ts +60 -0
- package/dist/src/tx/attestation.js +163 -0
- package/dist/src/tx/attestation.js.map +1 -0
- package/dist/src/tx/content.d.ts +27 -0
- package/dist/src/tx/content.js +62 -0
- package/dist/src/tx/content.js.map +1 -0
- package/dist/src/tx/encode.d.ts +60 -0
- package/dist/src/tx/encode.js +82 -0
- package/dist/src/tx/encode.js.map +1 -0
- package/dist/src/tx/expiry.d.ts +11 -0
- package/dist/src/tx/expiry.js +12 -0
- package/dist/src/tx/expiry.js.map +1 -0
- package/dist/src/tx/fee.d.ts +16 -0
- package/dist/src/tx/fee.js +29 -0
- package/dist/src/tx/fee.js.map +1 -0
- package/dist/src/tx/metadata.d.ts +39 -0
- package/dist/src/tx/metadata.js +66 -0
- package/dist/src/tx/metadata.js.map +1 -0
- package/dist/src/tx/nft.d.ts +16 -0
- package/dist/src/tx/nft.js +98 -0
- package/dist/src/tx/nft.js.map +1 -0
- package/dist/src/tx/proxy.d.ts +37 -0
- package/dist/src/tx/proxy.js +134 -0
- package/dist/src/tx/proxy.js.map +1 -0
- package/dist/src/tx/transfer.d.ts +31 -0
- package/dist/src/tx/transfer.js +123 -0
- package/dist/src/tx/transfer.js.map +1 -0
- package/dist/src/types.d.ts +448 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tests/account-id.test.d.ts +1 -0
- package/dist/tests/account-id.test.js +27 -0
- package/dist/tests/account-id.test.js.map +1 -0
- package/dist/tests/amount.test.d.ts +1 -0
- package/dist/tests/amount.test.js +113 -0
- package/dist/tests/amount.test.js.map +1 -0
- package/dist/tests/attestation.test.d.ts +1 -0
- package/dist/tests/attestation.test.js +182 -0
- package/dist/tests/attestation.test.js.map +1 -0
- package/dist/tests/chain.test.d.ts +1 -0
- package/dist/tests/chain.test.js +647 -0
- package/dist/tests/chain.test.js.map +1 -0
- package/dist/tests/content.test.d.ts +1 -0
- package/dist/tests/content.test.js +90 -0
- package/dist/tests/content.test.js.map +1 -0
- package/dist/tests/documented-api.test.d.ts +1 -0
- package/dist/tests/documented-api.test.js +229 -0
- package/dist/tests/documented-api.test.js.map +1 -0
- package/dist/tests/explorer.test.d.ts +1 -0
- package/dist/tests/explorer.test.js +95 -0
- package/dist/tests/explorer.test.js.map +1 -0
- package/dist/tests/fee.test.d.ts +1 -0
- package/dist/tests/fee.test.js +179 -0
- package/dist/tests/fee.test.js.map +1 -0
- package/dist/tests/fixtures/build-vll.d.ts +71 -0
- package/dist/tests/fixtures/build-vll.js +141 -0
- package/dist/tests/fixtures/build-vll.js.map +1 -0
- package/dist/tests/fixtures/fake-socket.d.ts +44 -0
- package/dist/tests/fixtures/fake-socket.js +93 -0
- package/dist/tests/fixtures/fake-socket.js.map +1 -0
- package/dist/tests/fixtures/fake-transport.d.ts +24 -0
- package/dist/tests/fixtures/fake-transport.js +30 -0
- package/dist/tests/fixtures/fake-transport.js.map +1 -0
- package/dist/tests/keypair.test.d.ts +1 -0
- package/dist/tests/keypair.test.js +163 -0
- package/dist/tests/keypair.test.js.map +1 -0
- package/dist/tests/ledger.test.d.ts +1 -0
- package/dist/tests/ledger.test.js +234 -0
- package/dist/tests/ledger.test.js.map +1 -0
- package/dist/tests/mnemonic.test.d.ts +1 -0
- package/dist/tests/mnemonic.test.js +97 -0
- package/dist/tests/mnemonic.test.js.map +1 -0
- package/dist/tests/nft-transfer.test.d.ts +1 -0
- package/dist/tests/nft-transfer.test.js +170 -0
- package/dist/tests/nft-transfer.test.js.map +1 -0
- package/dist/tests/nft.test.d.ts +1 -0
- package/dist/tests/nft.test.js +180 -0
- package/dist/tests/nft.test.js.map +1 -0
- package/dist/tests/offline.test.d.ts +1 -0
- package/dist/tests/offline.test.js +95 -0
- package/dist/tests/offline.test.js.map +1 -0
- package/dist/tests/proxy.test.d.ts +1 -0
- package/dist/tests/proxy.test.js +183 -0
- package/dist/tests/proxy.test.js.map +1 -0
- package/dist/tests/select.test.d.ts +1 -0
- package/dist/tests/select.test.js +200 -0
- package/dist/tests/select.test.js.map +1 -0
- package/dist/tests/socket.test.d.ts +1 -0
- package/dist/tests/socket.test.js +607 -0
- package/dist/tests/socket.test.js.map +1 -0
- package/dist/tests/transfer.test.d.ts +1 -0
- package/dist/tests/transfer.test.js +225 -0
- package/dist/tests/transfer.test.js.map +1 -0
- package/dist/tests/wallet-address.test.d.ts +1 -0
- package/dist/tests/wallet-address.test.js +101 -0
- package/dist/tests/wallet-address.test.js.map +1 -0
- package/dist/tests/wasm-loader.jest.d.ts +13 -0
- package/dist/tests/wasm-loader.jest.js +15 -0
- package/dist/tests/wasm-loader.jest.js.map +1 -0
- package/example/.env.example +4 -0
- package/example/README.md +304 -0
- package/example/USAGE.md +74 -0
- package/example/index.html +12 -0
- package/example/package-lock.json +1557 -0
- package/example/package.json +25 -0
- package/example/scripts/browser-check.mjs +1421 -0
- package/example/scripts/match-derivation.mjs +65 -0
- package/example/src/App.vue +138 -0
- package/example/src/components/AuthorityPanel.vue +277 -0
- package/example/src/components/ChainPanel.vue +267 -0
- package/example/src/components/ChainState.vue +59 -0
- package/example/src/components/CopyButton.vue +25 -0
- package/example/src/components/CreateAssetPanel.vue +313 -0
- package/example/src/components/DigitalAssetsPanel.vue +68 -0
- package/example/src/components/EvidencePanel.vue +396 -0
- package/example/src/components/ExplorerPanel.vue +119 -0
- package/example/src/components/KeypairPanel.vue +182 -0
- package/example/src/components/PhrasePanel.vue +105 -0
- package/example/src/components/SocketWarning.vue +18 -0
- package/example/src/components/StepGate.vue +24 -0
- package/example/src/components/TransferPanel.vue +416 -0
- package/example/src/components/TxDeadline.vue +19 -0
- package/example/src/components/TxFee.vue +31 -0
- package/example/src/components/TxStatus.vue +105 -0
- package/example/src/composables/useSocketConnection.ts +80 -0
- package/example/src/env.d.ts +12 -0
- package/example/src/main.ts +5 -0
- package/example/src/pennies.ts +7 -0
- package/example/src/style.css +149 -0
- package/example/tsconfig.json +19 -0
- package/example/vite.config.ts +26 -0
- package/jest.config.js +18 -0
- package/package.json +2 -6
- package/scripts/copy-wasm.mjs +21 -0
- package/scripts/smoke.mjs +382 -0
- package/src/address/record-type.ts +77 -0
- package/src/address/wallet-address.ts +105 -0
- package/src/amount.ts +143 -0
- package/src/assert.ts +30 -0
- package/src/capnp/README.md +15 -0
- package/src/capnp/adminNetTx.capnp.ts +66 -0
- package/src/capnp/appLayBlock.capnp.ts +26 -0
- package/src/capnp/appLayLedger.capnp.ts +35 -0
- package/src/capnp/appLayRec.capnp.ts +159 -0
- package/src/capnp/chainStateView.capnp.ts +49 -0
- package/src/capnp/coinAcctRec.capnp.ts +193 -0
- package/src/capnp/genesisBlock.capnp.ts +56 -0
- package/src/capnp/hubContentStmt.capnp.ts +59 -0
- package/src/capnp/misc.capnp.ts +19 -0
- package/src/capnp/netActorRec.capnp.ts +64 -0
- package/src/capnp/nodeContentStmt.capnp.ts +62 -0
- package/src/capnp/nodePayloadList.capnp.ts +28 -0
- package/src/capnp/nodeTxList.capnp.ts +37 -0
- package/src/capnp/paramAcctRec.capnp.ts +669 -0
- package/src/capnp/payload.capnp.ts +261 -0
- package/src/capnp/proxyAcctRec.capnp.ts +259 -0
- package/src/capnp/relayContentStmt.capnp.ts +85 -0
- package/src/capnp/sysAcctRec.capnp.ts +47 -0
- package/src/capnp/userAppTx.capnp.ts +269 -0
- package/src/capnp/userValTx.capnp.ts +1999 -0
- package/src/capnp/valLayBlock.capnp.ts +93 -0
- package/src/capnp/valLayLedger.capnp.ts +80 -0
- package/src/chain/geeq-chain.ts +1094 -0
- package/src/chain/geeq-node.ts +105 -0
- package/src/chain/nonce-guard.ts +73 -0
- package/src/chain/select.ts +149 -0
- package/src/crypto/account-id.ts +83 -0
- package/src/crypto/keypair.ts +221 -0
- package/src/crypto/mnemonic.ts +69 -0
- package/src/encoding/base64.ts +58 -0
- package/src/encoding/hex.ts +42 -0
- package/src/errors.ts +122 -0
- package/src/index.ts +195 -0
- package/src/ledger/coin-accounts.ts +73 -0
- package/src/ledger/decode.ts +147 -0
- package/src/ledger/geeq-ledger.ts +184 -0
- package/src/ledger/net-actors.ts +129 -0
- package/src/ledger/nft-records.ts +49 -0
- package/src/ledger/params.ts +82 -0
- package/src/ledger/proxy-accounts.ts +51 -0
- package/src/net/discovery.ts +231 -0
- package/src/net/explorer.ts +123 -0
- package/src/net/read-ledger.ts +58 -0
- package/src/net/routes.ts +79 -0
- package/src/net/transport.ts +221 -0
- package/src/net/websocket.ts +94 -0
- package/src/runtime/bindings.ts +38 -0
- package/src/runtime/init.ts +49 -0
- package/src/runtime/wasm-loader.browser.ts +22 -0
- package/src/runtime/wasm-loader.node.ts +16 -0
- package/src/socket/geeq-socket.ts +827 -0
- package/src/socket/tracked-tx.ts +319 -0
- package/src/socket/tx-status.ts +131 -0
- package/src/tx/attestation.ts +222 -0
- package/src/tx/content.ts +82 -0
- package/src/tx/encode.ts +107 -0
- package/src/tx/expiry.ts +11 -0
- package/src/tx/fee.ts +31 -0
- package/src/tx/metadata.ts +100 -0
- package/src/tx/nft.ts +108 -0
- package/src/tx/proxy.ts +156 -0
- package/src/tx/transfer.ts +162 -0
- package/src/types.ts +503 -0
- package/src/wasm/README.md +22 -0
- package/src/wasm/browser/geeq_core.d.ts +1224 -0
- package/src/wasm/browser/geeq_core.js +6014 -0
- package/src/wasm/browser/geeq_core_bg.wasm +0 -0
- package/src/wasm/browser/geeq_core_bg.wasm.d.ts +447 -0
- package/src/wasm/nodejs/geeq_core.d.ts +753 -0
- package/src/wasm/nodejs/geeq_core.js +6016 -0
- package/src/wasm/nodejs/geeq_core_bg.wasm +0 -0
- package/src/wasm/nodejs/geeq_core_bg.wasm.d.ts +447 -0
- package/src/wasm/nodejs/package.json +3 -0
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +21 -0
- package/tsup.config.ts +60 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { blake3 } from '@noble/hashes/blake3';
|
|
2
|
+
import { Message } from 'capnp-ts';
|
|
3
|
+
import { Payload as CapnpPayload } from '../capnp/payload.capnp';
|
|
4
|
+
import { UserAppTx as CapnpUserAppTx } from '../capnp/userAppTx.capnp';
|
|
5
|
+
import { penniesToUint64 } from '../amount';
|
|
6
|
+
import { ACCOUNT_ID_BYTES, PUBLIC_KEY_BYTES, resolveAccountId } from '../crypto/account-id';
|
|
7
|
+
import { invalidArgument } from '../errors';
|
|
8
|
+
import { assertReady, initGeeq } from '../runtime/init';
|
|
9
|
+
import { packPayload, signAppTx, signAttestationSubgroup } from './attestation';
|
|
10
|
+
import { assertAttestHash } from './content';
|
|
11
|
+
import { assertChainState, assertKeypair, pinning } from './encode';
|
|
12
|
+
import { feeFor } from './fee';
|
|
13
|
+
import { assertMetadataWithinLimits, encodeMetadata } from './metadata';
|
|
14
|
+
/**
|
|
15
|
+
* Build and sign an NFT mint. Synchronous; requires a loaded engine.
|
|
16
|
+
*
|
|
17
|
+
* An NFT is minted through a proxy, and the proxy is the sender: it pays the fee and
|
|
18
|
+
* `amount`, which goes to the receiver with the NFT, and it spends its own nonce. Its
|
|
19
|
+
* admin — the signer here — is the only key the chain accepts for it. The NFT itself is an
|
|
20
|
+
* attestation subgroup, as an attestation carries: the content's hash and its labels,
|
|
21
|
+
* signed by the admin and naming the proxy.
|
|
22
|
+
*
|
|
23
|
+
* Offline: it cannot check that the proxy exists, is the signer's, or can pay.
|
|
24
|
+
* {@link GeeqChain.mintNft} does all three.
|
|
25
|
+
*/
|
|
26
|
+
export function createNftMintTxSync(input) {
|
|
27
|
+
assertReady('createNftMintTxSync');
|
|
28
|
+
const { keypair, attestHash, amount, chainState } = input;
|
|
29
|
+
assertKeypair(keypair);
|
|
30
|
+
const proxyAccountId = resolveAccountId(input.proxyAccountId);
|
|
31
|
+
const to = resolveAccountId(input.to);
|
|
32
|
+
assertAttestHash(attestHash);
|
|
33
|
+
if (typeof amount !== 'bigint' || amount <= 0n) {
|
|
34
|
+
throw invalidArgument('amount must be a number of pennies greater than zero, as a bigint.');
|
|
35
|
+
}
|
|
36
|
+
assertChainState(chainState);
|
|
37
|
+
const { chainNumber, blockNumber, nodeNumber, nonce } = chainState;
|
|
38
|
+
const metadata = encodeMetadata(input.metadata);
|
|
39
|
+
assertMetadataWithinLimits(metadata, chainState.metadataLimits, { chainNumber, blockNumber });
|
|
40
|
+
// 1. The NFT: what it stands for, signed by the admin and naming the proxy. Its id is the
|
|
41
|
+
// hash of the signature-excluded subgroup, as the Geeq wallet computes it.
|
|
42
|
+
const { subgroup, flattened } = signAttestationSubgroup({
|
|
43
|
+
keypair,
|
|
44
|
+
attestHash,
|
|
45
|
+
metadata,
|
|
46
|
+
chainNumber,
|
|
47
|
+
accountId: proxyAccountId,
|
|
48
|
+
});
|
|
49
|
+
const nftId = blake3(flattened, { dkLen: ACCOUNT_ID_BYTES });
|
|
50
|
+
// 2. The payload carries the subgroup and the id.
|
|
51
|
+
const payloadMessage = new Message();
|
|
52
|
+
const mintPayload = payloadMessage.initRoot(CapnpPayload).initTxType().initNftMint();
|
|
53
|
+
mintPayload.setAttestationSubgroup(subgroup);
|
|
54
|
+
mintPayload.initAcctNumApp(ACCOUNT_ID_BYTES);
|
|
55
|
+
mintPayload.getAcctNumApp().copyBuffer(nftId);
|
|
56
|
+
const { payload, refHashPayload, bytes: payloadBytes } = packPayload(payloadMessage);
|
|
57
|
+
// 3. The transaction: from the proxy, to the receiver. The nonce is the proxy's, and the
|
|
58
|
+
// key is the admin's, which the node checks against the admin the proxy names.
|
|
59
|
+
const txMessage = new Message();
|
|
60
|
+
const tx = txMessage.initRoot(CapnpUserAppTx);
|
|
61
|
+
const txData = tx.getData();
|
|
62
|
+
const mint = txData.initTxType().initNftMint();
|
|
63
|
+
mint.setAmtCoin(penniesToUint64(amount));
|
|
64
|
+
mint.initAcctNumApp(ACCOUNT_ID_BYTES);
|
|
65
|
+
mint.getAcctNumApp().copyBuffer(nftId);
|
|
66
|
+
mint.initAcctNumRcv(ACCOUNT_ID_BYTES);
|
|
67
|
+
mint.getAcctNumRcv().copyBuffer(to);
|
|
68
|
+
mint.initAcctNumVal(ACCOUNT_ID_BYTES);
|
|
69
|
+
mint.getAcctNumVal().copyBuffer(proxyAccountId);
|
|
70
|
+
txData.setChainNum(chainNumber);
|
|
71
|
+
txData.setBlockNum(blockNumber);
|
|
72
|
+
txData.setNodeNum(nodeNumber);
|
|
73
|
+
txData.setNonce(nonce);
|
|
74
|
+
txData.initRefHashPayload(refHashPayload.length);
|
|
75
|
+
txData.getRefHashPayload().copyBuffer(refHashPayload);
|
|
76
|
+
txData.initPubKey(PUBLIC_KEY_BYTES);
|
|
77
|
+
txData.getPubKey().copyBuffer(keypair.publicKey);
|
|
78
|
+
const { transaction, transactionHash, bytes } = signAppTx(txMessage, tx, keypair);
|
|
79
|
+
return Object.freeze({
|
|
80
|
+
transaction,
|
|
81
|
+
payload,
|
|
82
|
+
refHashPayload,
|
|
83
|
+
transactionHash,
|
|
84
|
+
publicKey: keypair.publicKey,
|
|
85
|
+
nftId,
|
|
86
|
+
proxyAccountId,
|
|
87
|
+
to,
|
|
88
|
+
amount,
|
|
89
|
+
fee: feeFor(bytes + payloadBytes, amount, chainState.geeqNorm),
|
|
90
|
+
...pinning(chainState),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Build and sign an NFT mint, loading the engine if needed. */
|
|
94
|
+
export async function createNftMintTx(input) {
|
|
95
|
+
await initGeeq();
|
|
96
|
+
return createNftMintTxSync(input);
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=nft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nft.js","sourceRoot":"","sources":["../../../src/tx/nft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,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W,CAAC,WAAW,CAAC,CAAA;IAC/B,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IAC/B,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;IAC7B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACtB,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,CAAC,iBAAiB,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;IACrD,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;IACnC,MAAM,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAEhD,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;IAEjF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,WAAW;QACX,OAAO;QACP,cAAc;QACd,eAAe;QACf,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK;QACL,cAAc;QACd,EAAE;QACF,MAAM;QACN,GAAG,EAAE,MAAM,CAAC,KAAK,GAAG,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC;QAC9D,GAAG,OAAO,CAAC,UAAU,CAAC;KACvB,CAAC,CAAA;AACJ,CAAC;AAED,gEAAgE;AAChE,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAAqB;IACzD,MAAM,QAAQ,EAAE,CAAA;IAChB,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { GeeqLedger } from '../ledger/geeq-ledger';
|
|
2
|
+
import type { GeeqNftMintProxies, NftMintProxyTx, NftMintProxyTxInput } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The id of an admin's `index`-th NFT mint proxy.
|
|
5
|
+
*
|
|
6
|
+
* Derived rather than random, exactly as the Geeq wallet derives it, so every proxy an
|
|
7
|
+
* account made can be found again from its key alone. Requires a loaded engine.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function nftMintProxyId(adminPublicKey: Uint8Array, index: number): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* An admin's NFT mint proxies in `ledger`, each with its index, and the index the next
|
|
14
|
+
* one takes. Requires a loaded engine.
|
|
15
|
+
*
|
|
16
|
+
* The ledger knows a proxy's admin but not its index, so the index is found by deriving
|
|
17
|
+
* the admin's ids in order — 1, 2, 3… — until every proxy is matched.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function nftMintProxiesIn(ledger: GeeqLedger, admin: {
|
|
22
|
+
readonly publicKey: Uint8Array;
|
|
23
|
+
}): GeeqNftMintProxies;
|
|
24
|
+
/**
|
|
25
|
+
* Build and sign a transaction that creates an NFT mint proxy. Synchronous; requires a
|
|
26
|
+
* loaded engine.
|
|
27
|
+
*
|
|
28
|
+
* A proxy is a record of its own on the chain. It holds coin, carries its own nonce, and
|
|
29
|
+
* names one admin — the signer here — who is the only key that can mint NFTs through it.
|
|
30
|
+
* The signer pays `amount` onto it, plus the fee.
|
|
31
|
+
*
|
|
32
|
+
* Offline: it cannot check that the index is unused or that the signer can afford it.
|
|
33
|
+
* {@link GeeqChain.createNftMintProxy} does both.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createNftMintProxyTxSync(input: NftMintProxyTxInput): NftMintProxyTx;
|
|
36
|
+
/** Build and sign a proxy creation, loading the engine if needed. */
|
|
37
|
+
export declare function createNftMintProxyTx(input: NftMintProxyTxInput): Promise<NftMintProxyTx>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Message } from 'capnp-ts';
|
|
2
|
+
import { UserValTx as CapnpUserValTx } from '../capnp/userValTx.capnp';
|
|
3
|
+
import { createWalletAddressSync } from '../address/wallet-address';
|
|
4
|
+
import { penniesToUint64 } from '../amount';
|
|
5
|
+
import { assertUint32 } from '../assert';
|
|
6
|
+
import { ACCOUNT_ID_BYTES, PUBLIC_KEY_BYTES } from '../crypto/account-id';
|
|
7
|
+
import { toBase64 } from '../encoding/base64';
|
|
8
|
+
import { invalidArgument } from '../errors';
|
|
9
|
+
import { WasmIrnRecordType, wasmGenerateIrn } from '../runtime/bindings';
|
|
10
|
+
import { assertReady, initGeeq } from '../runtime/init';
|
|
11
|
+
import { assertChainState, assertKeypair, pinning } from './encode';
|
|
12
|
+
import { feeFor } from './fee';
|
|
13
|
+
import { signValidationTx } from './transfer';
|
|
14
|
+
/**
|
|
15
|
+
* How many indexes past the last one found the search keeps going before it decides an
|
|
16
|
+
* admin's remaining proxies were not derived from its key. Indexes are taken in order, so
|
|
17
|
+
* a gap is only ever creations that never landed.
|
|
18
|
+
*/
|
|
19
|
+
const MAX_INDEX_GAP = 100;
|
|
20
|
+
/**
|
|
21
|
+
* The id of an admin's `index`-th NFT mint proxy.
|
|
22
|
+
*
|
|
23
|
+
* Derived rather than random, exactly as the Geeq wallet derives it, so every proxy an
|
|
24
|
+
* account made can be found again from its key alone. Requires a loaded engine.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export function nftMintProxyId(adminPublicKey, index) {
|
|
29
|
+
return wasmGenerateIrn(WasmIrnRecordType.ProxyNftMint, adminPublicKey, index);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An admin's NFT mint proxies in `ledger`, each with its index, and the index the next
|
|
33
|
+
* one takes. Requires a loaded engine.
|
|
34
|
+
*
|
|
35
|
+
* The ledger knows a proxy's admin but not its index, so the index is found by deriving
|
|
36
|
+
* the admin's ids in order — 1, 2, 3… — until every proxy is matched.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export function nftMintProxiesIn(ledger, admin) {
|
|
41
|
+
const owned = ledger.findProxyAccounts({ admin });
|
|
42
|
+
const ids = new Set(owned.map((proxy) => toBase64(proxy.accountId)));
|
|
43
|
+
const indexOf = new Map();
|
|
44
|
+
let index = 0;
|
|
45
|
+
let highest = 0;
|
|
46
|
+
while (indexOf.size < ids.size && index - highest < MAX_INDEX_GAP) {
|
|
47
|
+
index += 1;
|
|
48
|
+
const id = toBase64(nftMintProxyId(admin.publicKey, index));
|
|
49
|
+
if (ids.has(id)) {
|
|
50
|
+
indexOf.set(id, index);
|
|
51
|
+
highest = index;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const proxies = owned
|
|
55
|
+
.map((proxy) => Object.freeze({
|
|
56
|
+
...proxy,
|
|
57
|
+
index: indexOf.get(toBase64(proxy.accountId)),
|
|
58
|
+
address: createWalletAddressSync({
|
|
59
|
+
accountId: proxy.accountId,
|
|
60
|
+
chainNumber: ledger.chainNumber,
|
|
61
|
+
recordType: 'proxy-nft-mint',
|
|
62
|
+
}),
|
|
63
|
+
}))
|
|
64
|
+
.sort((a, b) => (a.index ?? Number.MAX_SAFE_INTEGER) - (b.index ?? Number.MAX_SAFE_INTEGER));
|
|
65
|
+
return Object.freeze({ proxies, nextIndex: highest + 1 });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Build and sign a transaction that creates an NFT mint proxy. Synchronous; requires a
|
|
69
|
+
* loaded engine.
|
|
70
|
+
*
|
|
71
|
+
* A proxy is a record of its own on the chain. It holds coin, carries its own nonce, and
|
|
72
|
+
* names one admin — the signer here — who is the only key that can mint NFTs through it.
|
|
73
|
+
* The signer pays `amount` onto it, plus the fee.
|
|
74
|
+
*
|
|
75
|
+
* Offline: it cannot check that the index is unused or that the signer can afford it.
|
|
76
|
+
* {@link GeeqChain.createNftMintProxy} does both.
|
|
77
|
+
*/
|
|
78
|
+
export function createNftMintProxyTxSync(input) {
|
|
79
|
+
assertReady('createNftMintProxyTxSync');
|
|
80
|
+
const { keypair, index, amount, chainState } = input;
|
|
81
|
+
assertKeypair(keypair);
|
|
82
|
+
assertUint32(index, 'index');
|
|
83
|
+
if (index === 0) {
|
|
84
|
+
throw invalidArgument("index counts from 1, as the Geeq wallet counts an admin's proxies.");
|
|
85
|
+
}
|
|
86
|
+
if (typeof amount !== 'bigint' || amount <= 0n) {
|
|
87
|
+
throw invalidArgument('amount must be a number of pennies greater than zero, as a bigint.');
|
|
88
|
+
}
|
|
89
|
+
assertChainState(chainState);
|
|
90
|
+
const { chainNumber, blockNumber, nodeNumber, nonce } = chainState;
|
|
91
|
+
const message = new Message();
|
|
92
|
+
const tx = message.initRoot(CapnpUserValTx);
|
|
93
|
+
const data = tx.initData();
|
|
94
|
+
data.setChainNum(chainNumber);
|
|
95
|
+
data.setBlockNum(blockNumber);
|
|
96
|
+
data.setNodeNum(nodeNumber);
|
|
97
|
+
// The nonce and the payer's key sit on the proxy creation itself, as they do on a coin
|
|
98
|
+
// transfer's asset arm. The new record's id goes in the receiver's slot.
|
|
99
|
+
const proxyAccountId = nftMintProxyId(keypair.publicKey, index);
|
|
100
|
+
const create = data.initTx().initProxyCreate();
|
|
101
|
+
create.setNonce(nonce);
|
|
102
|
+
create.setAmtCoin(penniesToUint64(amount));
|
|
103
|
+
create.initAcctNumRcv(ACCOUNT_ID_BYTES);
|
|
104
|
+
create.getAcctNumRcv().copyBuffer(proxyAccountId);
|
|
105
|
+
create.initPubKey(PUBLIC_KEY_BYTES);
|
|
106
|
+
create.getPubKey().copyBuffer(keypair.publicKey);
|
|
107
|
+
// The admin is named by account id. A mint through the proxy is checked against it.
|
|
108
|
+
const nftMint = create.initTxType().initNftMint();
|
|
109
|
+
nftMint.initAcctNumAdminUser(ACCOUNT_ID_BYTES);
|
|
110
|
+
nftMint.getAcctNumAdminUser().copyBuffer(keypair.accountId);
|
|
111
|
+
const { transaction, transactionHash, bytes } = signValidationTx(message, tx, keypair, 'proxy creation');
|
|
112
|
+
return Object.freeze({
|
|
113
|
+
transaction,
|
|
114
|
+
transactionHash,
|
|
115
|
+
publicKey: keypair.publicKey,
|
|
116
|
+
amount,
|
|
117
|
+
index,
|
|
118
|
+
proxyAccountId,
|
|
119
|
+
proxyAddress: createWalletAddressSync({
|
|
120
|
+
accountId: proxyAccountId,
|
|
121
|
+
chainNumber,
|
|
122
|
+
recordType: 'proxy-nft-mint',
|
|
123
|
+
}),
|
|
124
|
+
// The funding counts as the amount sent, so it carries the coin part of the fee too.
|
|
125
|
+
fee: feeFor(bytes, amount, chainState.geeqNorm),
|
|
126
|
+
...pinning(chainState),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/** Build and sign a proxy creation, loading the engine if needed. */
|
|
130
|
+
export async function createNftMintProxyTx(input) {
|
|
131
|
+
await initGeeq();
|
|
132
|
+
return createNftMintProxyTxSync(input);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/tx/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE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G,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,WAAW;QACX,eAAe;QACf,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM;QACN,KAAK;QACL,cAAc;QACd,YAAY,EAAE,uBAAuB,CAAC;YACpC,SAAS,EAAE,cAAc;YACzB,WAAW;YACX,UAAU,EAAE,gBAAgB;SAC7B,CAAC;QACF,qFAAqF;QACrF,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC;QAC/C,GAAG,OAAO,CAAC,UAAU,CAAC;KACvB,CAAC,CAAA;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAA0B;IACnE,MAAM,QAAQ,EAAE,CAAA;IAChB,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Message } from 'capnp-ts';
|
|
2
|
+
import { UserValTx as CapnpUserValTx } from '../capnp/userValTx.capnp';
|
|
3
|
+
import type { CoinTransferTx, CoinTransferTxInput, GeeqKeypair } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Sign a built validation-layer transaction and work out the id the node files it under.
|
|
6
|
+
* Every validation-layer transaction — a transfer, a proxy creation — ends this way.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function signValidationTx(message: Message, tx: CapnpUserValTx, keypair: GeeqKeypair, what: string): {
|
|
11
|
+
transaction: string;
|
|
12
|
+
transactionHash: Uint8Array;
|
|
13
|
+
bytes: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Build and sign a coin transfer. Synchronous; requires a loaded engine.
|
|
17
|
+
*
|
|
18
|
+
* Unlike an attestation this is a **validation layer** transaction: it carries no
|
|
19
|
+
* separate payload, so there is one base64 blob to submit rather than two, and it is
|
|
20
|
+
* posted as type `uvt`.
|
|
21
|
+
*
|
|
22
|
+
* NFTs ride along in the same transaction, with coin: the chain's minimum transfer
|
|
23
|
+
* applies even when the point is the NFTs.
|
|
24
|
+
*
|
|
25
|
+
* Offline — it opens no sockets and reads no ledger. It cannot check that the sender can
|
|
26
|
+
* afford the transfer, that the amount clears the chain's minimum, or that it holds the
|
|
27
|
+
* NFTs; all three need a ledger. {@link GeeqChain.createTransfer} does check them.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createCoinTransferTxSync(input: CoinTransferTxInput): CoinTransferTx;
|
|
30
|
+
/** Build and sign a coin transfer, loading the engine if needed. */
|
|
31
|
+
export declare function createCoinTransferTx(input: CoinTransferTxInput): Promise<CoinTransferTx>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { blake3 } from '@noble/hashes/blake3';
|
|
2
|
+
import { Message } from 'capnp-ts';
|
|
3
|
+
import { UserValTx as CapnpUserValTx } from '../capnp/userValTx.capnp';
|
|
4
|
+
import { assertUint32 } from '../assert';
|
|
5
|
+
import { penniesToUint64 } from '../amount';
|
|
6
|
+
import { ACCOUNT_ID_BYTES, PUBLIC_KEY_BYTES, resolveAccountId } from '../crypto/account-id';
|
|
7
|
+
import { toBase64 } from '../encoding/base64';
|
|
8
|
+
import { invalidArgument } from '../errors';
|
|
9
|
+
import { WasmUserValTx, WasmUserValTxData } from '../runtime/bindings';
|
|
10
|
+
import { assertReady, initGeeq } from '../runtime/init';
|
|
11
|
+
import { REF_HASH_BYTES, assertChainState, assertKeypair, flatten, packed, pinning, resolveChainState, } from './encode';
|
|
12
|
+
import { feeFor } from './fee';
|
|
13
|
+
/**
|
|
14
|
+
* Sign a built validation-layer transaction and work out the id the node files it under.
|
|
15
|
+
* Every validation-layer transaction — a transfer, a proxy creation — ends this way.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function signValidationTx(message, tx, keypair, what) {
|
|
20
|
+
// A signature is a union here rather than a plain field, so it has to be told it is
|
|
21
|
+
// absent before it can be told what it is.
|
|
22
|
+
tx.initSignature().setNone();
|
|
23
|
+
tx.initEndorsements(0);
|
|
24
|
+
// Signed over the signature-EXCLUDED flatten, which is what the node verifies against.
|
|
25
|
+
const flattened = flatten(() => WasmUserValTxData.fromUserValTxCapnp(packed(message)), what);
|
|
26
|
+
const signature = keypair.sign(flattened);
|
|
27
|
+
tx.getSignature().initSome(signature.length);
|
|
28
|
+
tx.getSignature().getSome().copyBuffer(signature);
|
|
29
|
+
// The opposite of an attestation: the node identifies a validation-layer transaction by
|
|
30
|
+
// the hash of its signature-EXCLUDED flatten (geeq_node_core's UVT wrapper overrides
|
|
31
|
+
// computeRefHash with the no-signature form), and that is the value its uut_status
|
|
32
|
+
// events carry. Taken from the finished message rather than reusing the preimage, so
|
|
33
|
+
// it is computed exactly as the node computes it on receipt.
|
|
34
|
+
const transactionHash = blake3(flatten(() => WasmUserValTxData.fromUserValTxCapnp(packed(message)), `signed ${what}`), { dkLen: REF_HASH_BYTES });
|
|
35
|
+
// The fee, though, charges for the flatten WITH the signature: the node's data fee asks
|
|
36
|
+
// for that form whatever the transaction is identified by.
|
|
37
|
+
const signed = flatten(() => WasmUserValTx.fromUserValTxCapnp(packed(message)), `signed ${what}`);
|
|
38
|
+
return { transaction: toBase64(packed(message)), transactionHash, bytes: signed.length };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build and sign a coin transfer. Synchronous; requires a loaded engine.
|
|
42
|
+
*
|
|
43
|
+
* Unlike an attestation this is a **validation layer** transaction: it carries no
|
|
44
|
+
* separate payload, so there is one base64 blob to submit rather than two, and it is
|
|
45
|
+
* posted as type `uvt`.
|
|
46
|
+
*
|
|
47
|
+
* NFTs ride along in the same transaction, with coin: the chain's minimum transfer
|
|
48
|
+
* applies even when the point is the NFTs.
|
|
49
|
+
*
|
|
50
|
+
* Offline — it opens no sockets and reads no ledger. It cannot check that the sender can
|
|
51
|
+
* afford the transfer, that the amount clears the chain's minimum, or that it holds the
|
|
52
|
+
* NFTs; all three need a ledger. {@link GeeqChain.createTransfer} does check them.
|
|
53
|
+
*/
|
|
54
|
+
export function createCoinTransferTxSync(input) {
|
|
55
|
+
assertReady('createCoinTransferTxSync');
|
|
56
|
+
const { keypair } = input;
|
|
57
|
+
assertKeypair(keypair);
|
|
58
|
+
const chainState = resolveChainState(input);
|
|
59
|
+
const { chainNumber, blockNumber, nodeNumber, nonce } = chainState;
|
|
60
|
+
assertChainState(chainState);
|
|
61
|
+
const receiver = resolveAccountId(input.to);
|
|
62
|
+
if (toBase64(receiver) === toBase64(keypair.accountId)) {
|
|
63
|
+
throw invalidArgument('to is the sending account. A transfer to yourself moves nothing and still spends ' +
|
|
64
|
+
'a nonce and a fee.');
|
|
65
|
+
}
|
|
66
|
+
const pennies = input.amount;
|
|
67
|
+
if (typeof pennies !== 'bigint') {
|
|
68
|
+
throw invalidArgument('amount must already be resolved to pennies as a bigint.');
|
|
69
|
+
}
|
|
70
|
+
if (pennies <= 0n) {
|
|
71
|
+
throw invalidArgument(`amount must be greater than zero, received ${pennies} pennies.`);
|
|
72
|
+
}
|
|
73
|
+
const nfts = input.nfts ?? [];
|
|
74
|
+
for (const nft of nfts) {
|
|
75
|
+
if (!(nft.id instanceof Uint8Array) || nft.id.length !== ACCOUNT_ID_BYTES) {
|
|
76
|
+
throw invalidArgument(`An NFT id must be ${ACCOUNT_ID_BYTES} bytes.`);
|
|
77
|
+
}
|
|
78
|
+
assertUint32(nft.position, 'An NFT position');
|
|
79
|
+
}
|
|
80
|
+
if (new Set(nfts.map((nft) => toBase64(nft.id))).size !== nfts.length) {
|
|
81
|
+
throw invalidArgument('The same NFT is listed twice, and the chain refuses a transfer that does that.');
|
|
82
|
+
}
|
|
83
|
+
const message = new Message();
|
|
84
|
+
const tx = message.initRoot(CapnpUserValTx);
|
|
85
|
+
const data = tx.initData();
|
|
86
|
+
data.setChainNum(chainNumber);
|
|
87
|
+
data.setBlockNum(blockNumber);
|
|
88
|
+
data.setNodeNum(nodeNumber);
|
|
89
|
+
const asset = data.initTx().initCoin().initTxType().initAsset();
|
|
90
|
+
asset.setNonce(nonce);
|
|
91
|
+
asset.initAmtCoin().setSome(penniesToUint64(pennies));
|
|
92
|
+
// Both lists must exist even when empty, or the message is not well formed.
|
|
93
|
+
asset.initTokenAssetSubgroups(0);
|
|
94
|
+
const nftList = asset.initNftAssetSubgroups(nfts.length);
|
|
95
|
+
nfts.forEach((nft, index) => {
|
|
96
|
+
const entry = nftList.get(index);
|
|
97
|
+
entry.setPosition(nft.position);
|
|
98
|
+
const item = entry.initItem();
|
|
99
|
+
item.initAcctNumApp(ACCOUNT_ID_BYTES);
|
|
100
|
+
item.getAcctNumApp().copyBuffer(nft.id);
|
|
101
|
+
});
|
|
102
|
+
asset.initAcctNumRcv(ACCOUNT_ID_BYTES);
|
|
103
|
+
asset.getAcctNumRcv().copyBuffer(receiver);
|
|
104
|
+
asset.initPubKey(PUBLIC_KEY_BYTES);
|
|
105
|
+
asset.getPubKey().copyBuffer(keypair.publicKey);
|
|
106
|
+
const { transaction, transactionHash, bytes } = signValidationTx(message, tx, keypair, 'transfer');
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
transaction,
|
|
109
|
+
transactionHash,
|
|
110
|
+
publicKey: keypair.publicKey,
|
|
111
|
+
amount: pennies,
|
|
112
|
+
nfts: Object.freeze(nfts.map((nft) => nft.id)),
|
|
113
|
+
to: receiver,
|
|
114
|
+
fee: feeFor(bytes, pennies, chainState.geeqNorm),
|
|
115
|
+
...pinning(chainState),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** Build and sign a coin transfer, loading the engine if needed. */
|
|
119
|
+
export async function createCoinTransferTx(input) {
|
|
120
|
+
await initGeeq();
|
|
121
|
+
return createCoinTransferTxSync(input);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../../src/tx/transfer.ts"],"names":[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