signet.js 0.0.7 → 0.0.9-retry

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.
Files changed (183) hide show
  1. package/README.md +8 -1
  2. package/browser/index.browser.cjs +3 -0
  3. package/browser/index.browser.cjs.map +1 -0
  4. package/browser/index.browser.js +3 -0
  5. package/browser/index.browser.js.map +1 -0
  6. package/node/index.node.cjs +3 -0
  7. package/node/index.node.cjs.map +1 -0
  8. package/node/index.node.js +3 -0
  9. package/node/index.node.js.map +1 -0
  10. package/package.json +19 -18
  11. package/types/index.d.cts +1048 -0
  12. package/types/index.d.ts +1048 -0
  13. package/.eslintrc.json +0 -67
  14. package/.prettierrc +0 -1
  15. package/babel.config.js +0 -6
  16. package/docs/dist/.vocs/icons/arrow-diagonal.svg +0 -3
  17. package/docs/dist/.vocs/icons/chevron-down.svg +0 -13
  18. package/docs/dist/.vocs/icons/chevron-up.svg +0 -13
  19. package/docs/dist/.vocs/icons/link.svg +0 -3
  20. package/docs/dist/.vocs/search-index-7b499e25.json +0 -1
  21. package/docs/dist/assets/arbitrary-hash-Cd6eo8ZD.js +0 -309
  22. package/docs/dist/assets/broadcast-tx-CeTEE9yX.js +0 -8
  23. package/docs/dist/assets/btc-rpc-adapter-C-qSHpFV.js +0 -226
  24. package/docs/dist/assets/chain-adapter-interface-B9TpOgQv.js +0 -1280
  25. package/docs/dist/assets/chain-contract-interface-DEku3k45.js +0 -392
  26. package/docs/dist/assets/constructor-73n7bp3b.js +0 -161
  27. package/docs/dist/assets/constructor-Bg7nvLe0.js +0 -14
  28. package/docs/dist/assets/contract-addresses-BYlrAOs3.js +0 -200
  29. package/docs/dist/assets/derive-address-and-public-key-DExrKiGV.js +0 -14
  30. package/docs/dist/assets/finalize-message-signing-W435d71R.js +0 -20
  31. package/docs/dist/assets/finalize-transaction-signing-BIgJ2dnc.js +0 -36
  32. package/docs/dist/assets/finalize-transaction-signing-C--HJs8D.js +0 -24
  33. package/docs/dist/assets/finalize-transaction-signing-CjGmN7d9.js +0 -24
  34. package/docs/dist/assets/finalize-typed-data-signing-CEOp_GWt.js +0 -21
  35. package/docs/dist/assets/get-balance-DBC-i6KG.js +0 -13
  36. package/docs/dist/assets/get-current-signature-deposit-BXm9AzYy.js +0 -6
  37. package/docs/dist/assets/get-current-signature-deposit-nOw4j1MN.js +0 -6
  38. package/docs/dist/assets/get-derived-public-key-BXvfo2m2.js +0 -14
  39. package/docs/dist/assets/get-derived-public-key-DQ1pyiFS.js +0 -14
  40. package/docs/dist/assets/get-latest-key-version-DWlkMCre.js +0 -6
  41. package/docs/dist/assets/get-public-key-B4PFoVqu.js +0 -6
  42. package/docs/dist/assets/get-public-key-B9xkYkD_.js +0 -6
  43. package/docs/dist/assets/index-BFuwoY4w.js +0 -601
  44. package/docs/dist/assets/index-C62Mf-vy.js +0 -426
  45. package/docs/dist/assets/index-D8xhaiVb.js +0 -121
  46. package/docs/dist/assets/index-DTr0DlO0.js +0 -36
  47. package/docs/dist/assets/index-V9dXf-ik.js +0 -457
  48. package/docs/dist/assets/prepare-message-for-signing-DESTq-Hg.js +0 -16
  49. package/docs/dist/assets/prepare-transaction-for-signing-DIKTU0zj.js +0 -33
  50. package/docs/dist/assets/prepare-transaction-for-signing-DV_wkZ5g.js +0 -21
  51. package/docs/dist/assets/prepare-transaction-for-signing-LVDP0COu.js +0 -33
  52. package/docs/dist/assets/prepare-typed-data-for-signing-CWcmJvw0.js +0 -192
  53. package/docs/dist/assets/sign-CwtS5LnB.js +0 -13
  54. package/docs/dist/assets/sign-OQxf9yn7.js +0 -15
  55. package/docs/dist/assets/signet-quick-start-CQK52nVG.js +0 -350
  56. package/docs/dist/assets/sponsor-foreign-chain-gas-C9iWXM8Q.js +0 -1
  57. package/docs/dist/assets/style-CKGXuRqx.css +0 -1
  58. package/docs/dist/examples/arbitrary-hash/index.html +0 -88
  59. package/docs/dist/examples/sponsor-foreign-chain-gas/index.html +0 -21
  60. package/docs/dist/index.html +0 -56
  61. package/docs/dist/initializeTheme.iife.js +0 -1
  62. package/docs/dist/introduction/signet-quick-start/index.html +0 -109
  63. package/docs/dist/primitives/chain-adapter-interface/index.html +0 -515
  64. package/docs/dist/primitives/chain-contract-interface/index.html +0 -306
  65. package/docs/dist/primitives/contract-addresses/index.html +0 -97
  66. package/docs/dist/signet-logo.png +0 -0
  67. package/docs/dist/signetjs/chain-adapters/bitcoin/btc-rpc-adapter/index.html +0 -148
  68. package/docs/dist/signetjs/chain-adapters/bitcoin/finalize-transaction-signing/index.html +0 -41
  69. package/docs/dist/signetjs/chain-adapters/bitcoin/index.html +0 -187
  70. package/docs/dist/signetjs/chain-adapters/bitcoin/prepare-transaction-for-signing/index.html +0 -34
  71. package/docs/dist/signetjs/chain-adapters/broadcast-tx/index.html +0 -28
  72. package/docs/dist/signetjs/chain-adapters/cosmos/finalize-transaction-signing/index.html +0 -41
  73. package/docs/dist/signetjs/chain-adapters/cosmos/index.html +0 -166
  74. package/docs/dist/signetjs/chain-adapters/cosmos/prepare-transaction-for-signing/index.html +0 -43
  75. package/docs/dist/signetjs/chain-adapters/derive-address-and-public-key/index.html +0 -31
  76. package/docs/dist/signetjs/chain-adapters/evm/finalize-message-signing/index.html +0 -38
  77. package/docs/dist/signetjs/chain-adapters/evm/finalize-transaction-signing/index.html +0 -41
  78. package/docs/dist/signetjs/chain-adapters/evm/finalize-typed-data-signing/index.html +0 -39
  79. package/docs/dist/signetjs/chain-adapters/evm/index.html +0 -129
  80. package/docs/dist/signetjs/chain-adapters/evm/prepare-message-for-signing/index.html +0 -31
  81. package/docs/dist/signetjs/chain-adapters/evm/prepare-transaction-for-signing/index.html +0 -34
  82. package/docs/dist/signetjs/chain-adapters/evm/prepare-typed-data-for-signing/index.html +0 -49
  83. package/docs/dist/signetjs/chain-adapters/get-balance/index.html +0 -30
  84. package/docs/dist/signetjs/contracts/evm/constructor/index.html +0 -45
  85. package/docs/dist/signetjs/contracts/evm/get-current-signature-deposit/index.html +0 -26
  86. package/docs/dist/signetjs/contracts/evm/get-derived-public-key/index.html +0 -31
  87. package/docs/dist/signetjs/contracts/evm/get-latest-key-version/index.html +0 -26
  88. package/docs/dist/signetjs/contracts/evm/get-public-key/index.html +0 -26
  89. package/docs/dist/signetjs/contracts/evm/sign/index.html +0 -32
  90. package/docs/dist/signetjs/contracts/near/constructor/index.html +0 -34
  91. package/docs/dist/signetjs/contracts/near/get-current-signature-deposit/index.html +0 -26
  92. package/docs/dist/signetjs/contracts/near/get-derived-public-key/index.html +0 -31
  93. package/docs/dist/signetjs/contracts/near/get-public-key/index.html +0 -26
  94. package/docs/dist/signetjs/contracts/near/sign/index.html +0 -32
  95. package/docs/pages/examples/arbitrary-hash.mdx +0 -73
  96. package/docs/pages/examples/sponsor-foreign-chain-gas.mdx +0 -1
  97. package/docs/pages/index.mdx +0 -36
  98. package/docs/pages/introduction/signet-quick-start.mdx +0 -88
  99. package/docs/pages/primitives/chain-adapter-interface.mdx +0 -45
  100. package/docs/pages/primitives/chain-contract-interface.mdx +0 -52
  101. package/docs/pages/primitives/contract-addresses.mdx +0 -27
  102. package/docs/pages/signetjs/chain-adapters/bitcoin/btc-rpc-adapter.mdx +0 -26
  103. package/docs/pages/signetjs/chain-adapters/bitcoin/finalize-transaction-signing.mdx +0 -47
  104. package/docs/pages/signetjs/chain-adapters/bitcoin/index.mdx +0 -119
  105. package/docs/pages/signetjs/chain-adapters/bitcoin/prepare-transaction-for-signing.mdx +0 -30
  106. package/docs/pages/signetjs/chain-adapters/broadcast-tx.mdx +0 -23
  107. package/docs/pages/signetjs/chain-adapters/cosmos/finalize-transaction-signing.mdx +0 -53
  108. package/docs/pages/signetjs/chain-adapters/cosmos/index.mdx +0 -108
  109. package/docs/pages/signetjs/chain-adapters/cosmos/prepare-transaction-for-signing.mdx +0 -39
  110. package/docs/pages/signetjs/chain-adapters/derive-address-and-public-key.mdx +0 -28
  111. package/docs/pages/signetjs/chain-adapters/evm/finalize-message-signing.mdx +0 -33
  112. package/docs/pages/signetjs/chain-adapters/evm/finalize-transaction-signing.mdx +0 -44
  113. package/docs/pages/signetjs/chain-adapters/evm/finalize-typed-data-signing.mdx +0 -34
  114. package/docs/pages/signetjs/chain-adapters/evm/index.mdx +0 -84
  115. package/docs/pages/signetjs/chain-adapters/evm/prepare-message-for-signing.mdx +0 -26
  116. package/docs/pages/signetjs/chain-adapters/evm/prepare-transaction-for-signing.mdx +0 -30
  117. package/docs/pages/signetjs/chain-adapters/evm/prepare-typed-data-for-signing.mdx +0 -44
  118. package/docs/pages/signetjs/chain-adapters/get-balance.mdx +0 -26
  119. package/docs/pages/signetjs/contracts/evm/constructor.mdx +0 -38
  120. package/docs/pages/signetjs/contracts/evm/get-current-signature-deposit.mdx +0 -17
  121. package/docs/pages/signetjs/contracts/evm/get-derived-public-key.mdx +0 -28
  122. package/docs/pages/signetjs/contracts/evm/get-latest-key-version.mdx +0 -17
  123. package/docs/pages/signetjs/contracts/evm/get-public-key.mdx +0 -17
  124. package/docs/pages/signetjs/contracts/evm/sign.mdx +0 -36
  125. package/docs/pages/signetjs/contracts/near/constructor.mdx +0 -29
  126. package/docs/pages/signetjs/contracts/near/get-current-signature-deposit.mdx +0 -17
  127. package/docs/pages/signetjs/contracts/near/get-derived-public-key.mdx +0 -28
  128. package/docs/pages/signetjs/contracts/near/get-public-key.mdx +0 -17
  129. package/docs/pages/signetjs/contracts/near/sign.mdx +0 -32
  130. package/docs/public/signet-logo.png +0 -0
  131. package/docs/snippets/code/chains.ts +0 -42
  132. package/docs/snippets/code/contract.ts +0 -44
  133. package/docs/snippets/code/evm/contract.ts +0 -24
  134. package/docs/snippets/code/evm/env.ts +0 -16
  135. package/docs/snippets/code/near/env.ts +0 -13
  136. package/hardhat.config.mts +0 -19
  137. package/src/chain-adapters/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.ts +0 -15
  138. package/src/chain-adapters/Bitcoin/BTCRpcAdapter/Mempool/Mempool.ts +0 -101
  139. package/src/chain-adapters/Bitcoin/BTCRpcAdapter/Mempool/index.ts +0 -1
  140. package/src/chain-adapters/Bitcoin/BTCRpcAdapter/Mempool/types.ts +0 -72
  141. package/src/chain-adapters/Bitcoin/BTCRpcAdapter/index.ts +0 -6
  142. package/src/chain-adapters/Bitcoin/Bitcoin.ts +0 -287
  143. package/src/chain-adapters/Bitcoin/index.ts +0 -13
  144. package/src/chain-adapters/Bitcoin/types.ts +0 -48
  145. package/src/chain-adapters/Bitcoin/utils.ts +0 -14
  146. package/src/chain-adapters/ChainAdapter.ts +0 -92
  147. package/src/chain-adapters/Cosmos/Cosmos.ts +0 -258
  148. package/src/chain-adapters/Cosmos/index.ts +0 -8
  149. package/src/chain-adapters/Cosmos/types.ts +0 -35
  150. package/src/chain-adapters/Cosmos/utils.ts +0 -45
  151. package/src/chain-adapters/EVM/EVM.test.ts +0 -238
  152. package/src/chain-adapters/EVM/EVM.ts +0 -337
  153. package/src/chain-adapters/EVM/index.ts +0 -11
  154. package/src/chain-adapters/EVM/types.ts +0 -53
  155. package/src/chain-adapters/EVM/utils.ts +0 -27
  156. package/src/chain-adapters/index.ts +0 -5
  157. package/src/constants.ts +0 -62
  158. package/src/contracts/ChainSignatureContract.ts +0 -65
  159. package/src/contracts/evm/ChainSignaturesContract.ts +0 -323
  160. package/src/contracts/evm/ChainSignaturesContractABI.ts +0 -359
  161. package/src/contracts/evm/errors.ts +0 -52
  162. package/src/contracts/evm/index.ts +0 -10
  163. package/src/contracts/evm/types.ts +0 -39
  164. package/src/contracts/evm/utils.ts +0 -41
  165. package/src/contracts/index.ts +0 -4
  166. package/src/contracts/near/ChainSignatureContract.ts +0 -196
  167. package/src/contracts/near/account.ts +0 -42
  168. package/src/contracts/near/constants.ts +0 -4
  169. package/src/contracts/near/index.ts +0 -10
  170. package/src/contracts/near/signAndSend/index.ts +0 -1
  171. package/src/contracts/near/signAndSend/keypair.ts +0 -178
  172. package/src/contracts/near/transaction.ts +0 -202
  173. package/src/contracts/near/types.ts +0 -71
  174. package/src/index.ts +0 -5
  175. package/src/types.ts +0 -46
  176. package/src/utils/cryptography.ts +0 -141
  177. package/src/utils/index.ts +0 -1
  178. package/src/utils/publicKey.ts +0 -17
  179. package/tsconfig.eslint.json +0 -8
  180. package/tsconfig.json +0 -126
  181. package/tsup.config.ts +0 -58
  182. package/vitest.config.ts +0 -19
  183. package/vocs.config.ts +0 -213
@@ -1,108 +0,0 @@
1
- # Cosmos Chain
2
-
3
- The Cosmos chain implementation in Signet.js provides support for Cosmos SDK-based networks (Cosmos Hub, Osmosis, etc.) with a focus on standard transactions and IBC transfers.
4
-
5
- ## Overview
6
-
7
- The Cosmos implementation allows you to:
8
-
9
- - Generate addresses and public keys
10
- - Check balances
11
- - Prepare, sign, and broadcast transactions
12
- - Support for various Cosmos SDK message types
13
-
14
- ## Complete Transaction Example
15
-
16
- Below is a complete example of sending a transaction on a Cosmos chain using Signet.js:
17
-
18
- ```ts twoslash
19
- import { chainAdapters } from 'signet.js'
20
- // [!include ~/snippets/code/evm/contract.ts]
21
-
22
- const cosmos = new chainAdapters.cosmos.Cosmos({
23
- chainId: 'cosmoshub-4',
24
- contract: evmChainSigContract,
25
- })
26
-
27
- const path = 'cosmos'
28
- const predecessorId = walletClient.account.address
29
-
30
- const { address: from, publicKey } = await cosmos.deriveAddressAndPublicKey(
31
- predecessorId,
32
- path
33
- )
34
-
35
- const { balance, decimals } = await cosmos.getBalance(from)
36
-
37
- const { transaction, hashesToSign } = await cosmos.prepareTransactionForSigning(
38
- {
39
- address: from,
40
- publicKey,
41
- messages: [
42
- {
43
- typeUrl: '/cosmos.bank.v1beta1.MsgSend',
44
- value: {
45
- fromAddress: from,
46
- toAddress: 'cosmos1jq304cthpx0lwhpqzrdjrcza559ukyy347xu57',
47
- amount: [
48
- {
49
- denom: 'uatom',
50
- amount: '1000000', // 1 ATOM (1,000,000 uatom)
51
- },
52
- ],
53
- },
54
- },
55
- ],
56
- memo: 'Sent via Signet.js',
57
- }
58
- )
59
-
60
- const rsvSignature = await evmChainSigContract.sign({
61
- payload: hashesToSign[0],
62
- path,
63
- key_version: 0,
64
- })
65
-
66
- const tx = cosmos.finalizeTransactionSigning({
67
- transaction,
68
- rsvSignatures: [rsvSignature],
69
- })
70
-
71
- const txHash = await cosmos.broadcastTx(tx)
72
- ```
73
-
74
- ### Supported Networks
75
-
76
- You can use any Cosmos SDK-based network by providing the appropriate chain ID:
77
-
78
- ```ts twoslash
79
- // [!include ~/snippets/code/contract.ts]
80
- // ---cut---
81
- import { chainAdapters } from 'signet.js'
82
-
83
- // Cosmos Hub
84
- const cosmosHub = new chainAdapters.cosmos.Cosmos({
85
- chainId: 'cosmoshub-4',
86
- contract: evmChainSigContract,
87
- })
88
-
89
- // Osmosis
90
- const osmosis = new chainAdapters.cosmos.Cosmos({
91
- chainId: 'osmosis-1',
92
- contract: evmChainSigContract,
93
- })
94
-
95
- // Juno
96
- const juno = new chainAdapters.cosmos.Cosmos({
97
- chainId: 'juno-1',
98
- contract: evmChainSigContract,
99
- })
100
- ```
101
-
102
- ## Types
103
-
104
- The following types are used on the Cosmos chain:
105
-
106
- ```ts twoslash
107
- // [!include ~/../src/chain-adapters/Cosmos/types.ts]
108
- ```
@@ -1,39 +0,0 @@
1
- # prepareTransactionForSigning
2
-
3
- The `prepareTransactionForSigning` method prepares a Cosmos transaction for MPC signing by creating the transaction structure and computing the hash that needs to be signed.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- const { transaction, hashesToSign } =
11
- await cosmosChain.prepareTransactionForSigning({
12
- address: 'cosmos1...',
13
- publicKey: '0350e8...',
14
- messages: [
15
- {
16
- typeUrl: '/cosmos.bank.v1beta1.MsgSend',
17
- value: {
18
- fromAddress: 'cosmos1...',
19
- toAddress: 'cosmos1...',
20
- amount: [{ denom: 'uatom', amount: '1000000' }],
21
- },
22
- },
23
- ],
24
- memo: 'Token transfer',
25
- })
26
- ```
27
-
28
- ## Parameters
29
-
30
- | Parameter | Type | Description |
31
- | -------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------- |
32
- | `transactionRequest` | `CosmosTransactionRequest` | The transaction request object containing address, publicKey, messages, and optional memo and fee settings |
33
-
34
- ## Returns
35
-
36
- | Property | Type | Description |
37
- | -------------- | --------------------------- | ------------------------------------------ |
38
- | `transaction` | `CosmosUnsignedTransaction` | Object containing the unsigned transaction |
39
- | `hashesToSign` | `string[]` | Array of hashes that need to be signed |
@@ -1,28 +0,0 @@
1
- # deriveAddressAndPublicKey
2
-
3
- The `deriveAddressAndPublicKey` method derives an address and public key from a predecessor ID and derivation path.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- const { address, publicKey } = await evmChain.deriveAddressAndPublicKey(
11
- '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
12
- 'my_derivation_path'
13
- )
14
- ```
15
-
16
- ## Parameters
17
-
18
- | Parameter | Type | Description |
19
- | ------------- | -------- | ---------------------------------------------------- |
20
- | `predecessor` | `string` | The wallet/contract address requesting the signature |
21
- | `path` | `string` | The derivation path to use |
22
-
23
- ## Returns
24
-
25
- | Property | Type | Description |
26
- | ----------- | -------- | -------------------------------------------------------- |
27
- | `address` | `string` | The derived address |
28
- | `publicKey` | `string` | The corresponding public key in SEC1 uncompressed format |
@@ -1,33 +0,0 @@
1
- # finalizeMessageSigning
2
-
3
- The `finalizeMessageSigning` assemble the Message signature
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- import { RSVSignature } from 'signet.js'
11
-
12
- const rsvSignature: RSVSignature = {
13
- r: '0x123...',
14
- s: '0x123...',
15
- v: 27,
16
- }
17
-
18
- const signature = evmChain.finalizeMessageSigning({
19
- rsvSignature,
20
- })
21
- ```
22
-
23
- ## Parameters
24
-
25
- | Parameter | Type | Description |
26
- | -------------- | -------------- | -------------------------------------- |
27
- | `rsvSignature` | `RSVSignature` | The RSV signature from the MPC network |
28
-
29
- ## Returns
30
-
31
- | Type | Description |
32
- | -------- | -------------------------------------------- |
33
- | `string` | The signature in hex format (with 0x prefix) |
@@ -1,44 +0,0 @@
1
- # finalizeTransactionSigning
2
-
3
- The `finalizeTransactionSigning` method adds a signature to an unsigned transaction, producing a signed transaction that can be broadcast to the network.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- const { transaction, hashesToSign } =
10
- await evmChain.prepareTransactionForSigning({
11
- to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
12
- from: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
13
- value: 1n,
14
- data: '0x',
15
- })
16
- // ---cut---
17
- import { RSVSignature } from 'signet.js'
18
-
19
- const rsvSignatures: RSVSignature[] = [
20
- {
21
- r: '0x123...',
22
- s: '0x123...',
23
- v: 27,
24
- },
25
- ]
26
-
27
- const signedTx = evmChain.finalizeTransactionSigning({
28
- transaction,
29
- rsvSignatures,
30
- })
31
- ```
32
-
33
- ## Parameters
34
-
35
- | Parameter | Type | Description |
36
- | --------------- | ------------------------ | ------------------------------------------------------------------- |
37
- | `transaction` | `EVMUnsignedTransaction` | The unsigned transaction prepared by `prepareTransactionForSigning` |
38
- | `rsvSignatures` | `RSVSignature[]` | Array of RSV signatures from the MPC network |
39
-
40
- ## Returns
41
-
42
- | Type | Description |
43
- | -------- | ------------------------------------------------------------- |
44
- | `string` | The serialized signed transaction (hex string with 0x prefix) |
@@ -1,34 +0,0 @@
1
- # finalizeTypedDataSigning
2
-
3
- The `finalizeTypedDataSigning` method adds a signature to EIP-712 typed data, producing a signature that can be verified by Ethereum-compatible systems.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- import { RSVSignature } from 'signet.js'
11
-
12
- const rsvSignature: RSVSignature = {
13
- r: '0x123...',
14
- s: '0x123...',
15
- v: 27,
16
- }
17
-
18
- // Assuming you have a signature from the MPC network
19
- const signature = evmChain.finalizeTypedDataSigning({
20
- rsvSignature,
21
- })
22
- ```
23
-
24
- ## Parameters
25
-
26
- | Parameter | Type | Description |
27
- | -------------- | -------------- | -------------------------------------- |
28
- | `rsvSignature` | `RSVSignature` | The RSV signature from the MPC network |
29
-
30
- ## Returns
31
-
32
- | Type | Description |
33
- | -------- | -------------------------------------------- |
34
- | `string` | The signature in hex format (with 0x prefix) |
@@ -1,84 +0,0 @@
1
- # EVM Chain
2
-
3
- The EVM (Ethereum Virtual Machine) chain implementation in Signet.js provides support for all EVM-compatible networks, including Ethereum, Binance Smart Chain, Polygon, Arbitrum, and more.
4
-
5
- ## Overview
6
-
7
- The EVM implementation allows you to:
8
-
9
- - Derive addresses and public keys
10
- - Check balances
11
- - Prepare, sign, and broadcast transactions
12
- - Sign messages (EIP-191)
13
- - Sign typed data (EIP-712)
14
-
15
- ## Complete Transaction Example
16
-
17
- Below is a complete example of sending a transaction on an EVM chain using Signet.js:
18
-
19
- ```ts twoslash
20
- import { chainAdapters } from 'signet.js'
21
- // [!include ~/snippets/code/evm/contract.ts]
22
-
23
- const evm = new chainAdapters.evm.EVM({
24
- rpcUrl: 'https://sepolia.infura.io/v3/YOUR-PROJECT-ID',
25
- contract: evmChainSigContract,
26
- })
27
-
28
- const path = 'eth'
29
- const predecessorId = walletClient.account.address
30
-
31
- const { address: from, publicKey } = await evm.deriveAddressAndPublicKey(
32
- predecessorId,
33
- path
34
- )
35
-
36
- const { balance, decimals } = await evm.getBalance(from)
37
-
38
- const { transaction, hashesToSign } = await evm.prepareTransactionForSigning({
39
- from: from as `0x${string}`,
40
- to: '0x4174678c78fEaFd778c1ff319D5D326701449b25',
41
- value: 1n, // Amount in wei (1 wei in this example)
42
- })
43
-
44
- const rsvSignature = await evmChainSigContract.sign({
45
- payload: hashesToSign[0],
46
- path,
47
- key_version: 0,
48
- })
49
-
50
- const tx = evm.finalizeTransactionSigning({
51
- transaction,
52
- rsvSignatures: [rsvSignature],
53
- })
54
-
55
- const txHash = await evm.broadcastTx(tx)
56
- ```
57
-
58
- ### Supported Networks
59
-
60
- You can use any EVM-compatible network by providing the appropriate RPC URL:
61
-
62
- ```ts twoslash
63
- // [!include ~/snippets/code/contract.ts]
64
- // ---cut---
65
- import { chainAdapters } from 'signet.js'
66
-
67
- // Ethereum Mainnet
68
- const ethereumChain = new chainAdapters.evm.EVM({
69
- rpcUrl: 'https://mainnet.infura.io/v3/YOUR-PROJECT-ID',
70
- contract: evmChainSigContract,
71
- })
72
-
73
- // Polygon (Matic)
74
- const polygonChain = new chainAdapters.evm.EVM({
75
- rpcUrl: 'https://polygon-rpc.com',
76
- contract: evmChainSigContract,
77
- })
78
-
79
- // Binance Smart Chain
80
- const bscChain = new chainAdapters.evm.EVM({
81
- rpcUrl: 'https://bsc-dataseed.binance.org',
82
- contract: evmChainSigContract,
83
- })
84
- ```
@@ -1,26 +0,0 @@
1
- # prepareMessageForSigning
2
-
3
- The `prepareMessageForSigning` method prepares a message for MPC signing according to EIP-191 (Ethereum signed message standard).
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
-
11
- const message: chainAdapters.evm.EVMMessage = 'Sign this message'
12
-
13
- const { hashToSign } = await evmChain.prepareMessageForSigning(message)
14
- ```
15
-
16
- ## Parameters
17
-
18
- | Parameter | Type | Description |
19
- | --------- | ------------ | ------------------------ |
20
- | `message` | `EVMMessage` | The message to be signed |
21
-
22
- ## Returns
23
-
24
- | Property | Type | Description |
25
- | ------------ | ------------ | ---------------------------------------- |
26
- | `hashToSign` | `HashToSign` | The hash to be signed by the MPC network |
@@ -1,30 +0,0 @@
1
- # prepareTransactionForSigning
2
-
3
- The `prepareTransactionForSigning` method prepares an EVM transaction for MPC signing by adding necessary fields like gas estimation, nonce, and chain ID.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- const { transaction, hashesToSign } =
11
- await evmChain.prepareTransactionForSigning({
12
- to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
13
- from: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
14
- value: 1n, // 1 wei
15
- data: '0x', // Empty data for a simple ETH transfer
16
- })
17
- ```
18
-
19
- ## Parameters
20
-
21
- | Parameter | Type | Description |
22
- | -------------------- | ----------------------- | ------------------------------ |
23
- | `transactionRequest` | `EVMTransactionRequest` | The transaction request object |
24
-
25
- ## Returns
26
-
27
- | Property | Type | Description |
28
- | -------------- | ------------------------ | ------------------------------------------------- |
29
- | `transaction` | `EVMUnsignedTransaction` | The prepared transaction with all required fields |
30
- | `hashesToSign` | `HashToSign[]` | Array of hash(es) to be signed by the MPC network |
@@ -1,44 +0,0 @@
1
- # prepareTypedDataForSigning
2
-
3
- The `prepareTypedDataForSigning` method prepares EIP-712 typed data for MPC signing.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
-
11
- const typedData: chainAdapters.evm.EVMTypedData = {
12
- domain: {
13
- name: 'My dApp',
14
- version: '1',
15
- chainId: 1,
16
- verifyingContract: '0x1234567890123456789012345678901234567890',
17
- },
18
- types: {
19
- Person: [
20
- { name: 'name', type: 'string' },
21
- { name: 'wallet', type: 'address' },
22
- ],
23
- },
24
- primaryType: 'Person',
25
- message: {
26
- name: 'Alice',
27
- wallet: '0x1234567890123456789012345678901234567890',
28
- },
29
- }
30
-
31
- const { hashToSign } = await evmChain.prepareTypedDataForSigning(typedData)
32
- ```
33
-
34
- ## Parameters
35
-
36
- | Parameter | Type | Description |
37
- | ----------- | -------------- | ------------------------------------------ |
38
- | `typedData` | `EVMTypedData` | The EIP-712 typed data object to be signed |
39
-
40
- ## Returns
41
-
42
- | Property | Type | Description |
43
- | ------------ | ------------ | ---------------------------------------- |
44
- | `hashToSign` | `HashToSign` | The hash to be signed by the MPC network |
@@ -1,26 +0,0 @@
1
- # getBalance
2
-
3
- The `getBalance` method retrieves the native token balance of an address.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/chains.ts]
9
- // ---cut---
10
- const { balance, decimals } = await evmChain.getBalance(
11
- '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199'
12
- )
13
- ```
14
-
15
- ## Parameters
16
-
17
- | Parameter | Type | Description |
18
- | --------- | -------- | ------------------------------------ |
19
- | `address` | `string` | The address to check the balance for |
20
-
21
- ## Returns
22
-
23
- | Property | Type | Description |
24
- | ---------- | -------- | ------------------------------------------------------------------- |
25
- | `balance` | `bigint` | The balance in the chain's base units (wei for Ethereum) |
26
- | `decimals` | `number` | The number of decimals used to format the balance (18 for Ethereum) |
@@ -1,38 +0,0 @@
1
- # EVM Chain Signatures Contract
2
-
3
- The EVM Chain Signatures Contract provides an implementation of the abstract `ChainSignatureContract` for EVM-compatible blockchains. It allows you to interact with the Chain Signatures contract deployed on EVM chains.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- import { contracts, constants } from 'signet.js'
9
- import { createPublicClient, createWalletClient, http } from 'viem'
10
- import { sepolia } from 'viem/chains'
11
-
12
- const publicClient = createPublicClient({
13
- chain: sepolia,
14
- transport: http(),
15
- })
16
-
17
- const walletClient = createWalletClient({
18
- chain: sepolia,
19
- transport: http(),
20
- })
21
-
22
- const contract = new contracts.evm.ChainSignatureContract({
23
- publicClient,
24
- walletClient,
25
- contractAddress: constants.CONTRACT_ADDRESSES.ETHEREUM
26
- .TESTNET_DEV as `0x${string}`,
27
- })
28
- ```
29
-
30
- ## Parameters
31
-
32
- | Parameter | Type | Description |
33
- | ---------------------- | -------------- | ------------------------------------------------------------------------------- |
34
- | `args` | `object` | Configuration options for the contract |
35
- | `args.publicClient` | `PublicClient` | A Viem PublicClient instance for reading from the blockchain |
36
- | `args.walletClient` | `WalletClient` | A Viem WalletClient instance for sending transactions |
37
- | `args.contractAddress` | `Hex` | The address of the deployed ChainSignatures contract |
38
- | `args.rootPublicKey?` | `NajPublicKey` | Optional root public key. If not provided, it will be derived from the contract |
@@ -1,17 +0,0 @@
1
- # getCurrentSignatureDeposit
2
-
3
- Retrieves the current signature deposit amount required by the contract.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/contract.ts]
9
- // ---cut---
10
- const deposit = await evmChainSigContract.getCurrentSignatureDeposit()
11
- ```
12
-
13
- ## Returns
14
-
15
- | Type | Description |
16
- | ------------- | ------------------------------------------- |
17
- | `Promise<BN>` | The current signature deposit amount in wei |
@@ -1,28 +0,0 @@
1
- # getDerivedPublicKey
2
-
3
- Derives a public key from a predecessor ID and derivation path.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/contract.ts]
9
- // ---cut---
10
- const publicKey = await evmChainSigContract.getDerivedPublicKey({
11
- path: 'my_derivation_path',
12
- predecessor: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
13
- })
14
- ```
15
-
16
- ## Parameters
17
-
18
- | Parameter | Type | Description |
19
- | ------------------ | -------- | ---------------------------------------------------- |
20
- | `args` | `object` | Arguments for deriving the public key |
21
- | `args.path` | `string` | The derivation path to use |
22
- | `args.predecessor` | `string` | The wallet/contract address requesting the signature |
23
-
24
- ## Returns
25
-
26
- | Type | Description |
27
- | --------------------------------- | -------------------------------------------------- |
28
- | `Promise<UncompressedPubKeySEC1>` | The derived public key in SEC1 uncompressed format |
@@ -1,17 +0,0 @@
1
- # getLatestKeyVersion
2
-
3
- Retrieves the latest key version from the contract.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/contract.ts]
9
- // ---cut---
10
- const keyVersion = await evmChainSigContract.getLatestKeyVersion()
11
- ```
12
-
13
- ## Returns
14
-
15
- | Type | Description |
16
- | ----------------- | ---------------------- |
17
- | `Promise<number>` | The latest key version |
@@ -1,17 +0,0 @@
1
- # getPublicKey
2
-
3
- Retrieves the root public key from the contract.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/contract.ts]
9
- // ---cut---
10
- const publicKey = await evmChainSigContract.getPublicKey()
11
- ```
12
-
13
- ## Returns
14
-
15
- | Type | Description |
16
- | --------------------------------- | ----------------------------------------------- |
17
- | `Promise<UncompressedPubKeySEC1>` | The root public key in SEC1 uncompressed format |
@@ -1,36 +0,0 @@
1
- # sign
2
-
3
- Signs data using the Chain Signatures contract.
4
-
5
- ## Usage
6
-
7
- ```ts twoslash
8
- // [!include ~/snippets/code/contract.ts]
9
- // ---cut---
10
- const signature = await evmChainSigContract.sign({
11
- path: 'my_derivation_path',
12
- payload: Array.from(new Uint8Array(32).fill(1)), // 32-byte array
13
- key_version: 0,
14
- })
15
- ```
16
-
17
- ## Parameters
18
-
19
- | Parameter | Type | Description |
20
- | --------------------------- | ------------- | ----------------------------------------------------- |
21
- | `args` | `SignArgs` | Arguments for signing data |
22
- | `args.path` | `string` | The derivation path to use |
23
- | `args.payload` | `number[]` | The data to sign as an array of 32 bytes |
24
- | `args.key_version` | `number` | Version of the key to use |
25
- | `options?` | `SignOptions` | Optional configuration for signing |
26
- | `options.sign.algo?` | `string` | Optional algorithm to use for signing |
27
- | `options.sign.dest?` | `string` | Optional destination for the signature |
28
- | `options.sign.params?` | `string` | Optional parameters for the signing process |
29
- | `options.retry.delay?` | `number` | Delay between retries in milliseconds (default: 5000) |
30
- | `options.retry.retryCount?` | `number` | Number of retries to attempt (default: 12) |
31
-
32
- ## Returns
33
-
34
- | Type | Description |
35
- | ----------------------- | --------------------------- |
36
- | `Promise<RSVSignature>` | The signature in RSV format |