@amadeus-protocol/sdk 1.0.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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +410 -0
  3. package/dist/api/chain.d.ts +119 -0
  4. package/dist/api/chain.d.ts.map +1 -0
  5. package/dist/api/chain.js +147 -0
  6. package/dist/api/chain.js.map +1 -0
  7. package/dist/api/contract.d.ts +62 -0
  8. package/dist/api/contract.d.ts.map +1 -0
  9. package/dist/api/contract.js +76 -0
  10. package/dist/api/contract.js.map +1 -0
  11. package/dist/api/epoch.d.ts +68 -0
  12. package/dist/api/epoch.d.ts.map +1 -0
  13. package/dist/api/epoch.js +99 -0
  14. package/dist/api/epoch.js.map +1 -0
  15. package/dist/api/index.d.ts +8 -0
  16. package/dist/api/index.d.ts.map +1 -0
  17. package/dist/api/index.js +8 -0
  18. package/dist/api/index.js.map +1 -0
  19. package/dist/api/peer.d.ts +80 -0
  20. package/dist/api/peer.d.ts.map +1 -0
  21. package/dist/api/peer.js +95 -0
  22. package/dist/api/peer.js.map +1 -0
  23. package/dist/api/proof.d.ts +25 -0
  24. package/dist/api/proof.d.ts.map +1 -0
  25. package/dist/api/proof.js +30 -0
  26. package/dist/api/proof.js.map +1 -0
  27. package/dist/api/transaction.d.ts +71 -0
  28. package/dist/api/transaction.d.ts.map +1 -0
  29. package/dist/api/transaction.js +85 -0
  30. package/dist/api/transaction.js.map +1 -0
  31. package/dist/api/wallet.d.ts +39 -0
  32. package/dist/api/wallet.d.ts.map +1 -0
  33. package/dist/api/wallet.js +51 -0
  34. package/dist/api/wallet.js.map +1 -0
  35. package/dist/client.d.ts +70 -0
  36. package/dist/client.d.ts.map +1 -0
  37. package/dist/client.js +280 -0
  38. package/dist/client.js.map +1 -0
  39. package/dist/constants.d.ts +42 -0
  40. package/dist/constants.d.ts.map +1 -0
  41. package/dist/constants.js +42 -0
  42. package/dist/constants.js.map +1 -0
  43. package/dist/conversion.d.ts +32 -0
  44. package/dist/conversion.d.ts.map +1 -0
  45. package/dist/conversion.js +50 -0
  46. package/dist/conversion.js.map +1 -0
  47. package/dist/crypto.d.ts +93 -0
  48. package/dist/crypto.d.ts.map +1 -0
  49. package/dist/crypto.js +156 -0
  50. package/dist/crypto.js.map +1 -0
  51. package/dist/encoding.d.ts +108 -0
  52. package/dist/encoding.d.ts.map +1 -0
  53. package/dist/encoding.js +165 -0
  54. package/dist/encoding.js.map +1 -0
  55. package/dist/encryption.d.ts +76 -0
  56. package/dist/encryption.d.ts.map +1 -0
  57. package/dist/encryption.js +137 -0
  58. package/dist/encryption.js.map +1 -0
  59. package/dist/index.d.ts +47 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +47 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/schemas.d.ts +67 -0
  64. package/dist/schemas.d.ts.map +1 -0
  65. package/dist/schemas.js +103 -0
  66. package/dist/schemas.js.map +1 -0
  67. package/dist/sdk.d.ts +100 -0
  68. package/dist/sdk.d.ts.map +1 -0
  69. package/dist/sdk.js +120 -0
  70. package/dist/sdk.js.map +1 -0
  71. package/dist/serialization.d.ts +42 -0
  72. package/dist/serialization.d.ts.map +1 -0
  73. package/dist/serialization.js +247 -0
  74. package/dist/serialization.js.map +1 -0
  75. package/dist/transaction-builder.d.ts +267 -0
  76. package/dist/transaction-builder.d.ts.map +1 -0
  77. package/dist/transaction-builder.js +397 -0
  78. package/dist/transaction-builder.js.map +1 -0
  79. package/dist/types.d.ts +550 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +78 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/validation.d.ts +15 -0
  84. package/dist/validation.d.ts.map +1 -0
  85. package/dist/validation.js +39 -0
  86. package/dist/validation.js.map +1 -0
  87. package/package.json +80 -0
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Transaction Builder
3
+ *
4
+ * This module provides a class-based API for building and signing Amadeus protocol transactions.
5
+ */
6
+ import type { PrivKey } from '@noble/curves/utils';
7
+ import type { BuildTransactionResult, SerializableValue, TransferTransactionInput, UnsignedTransactionWithHash } from './types';
8
+ /**
9
+ * Transaction Builder for Amadeus Protocol
10
+ *
11
+ * Provides methods for building and signing transactions. Can be instantiated
12
+ * with a private key for convenience, or used statically.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Instance-based usage
17
+ * const builder = new TransactionBuilder('5Kd3N...')
18
+ * const { txHash, txPacked } = builder.transfer({
19
+ * recipient: '5Kd3N...',
20
+ * amount: 10.5,
21
+ * symbol: 'AMA'
22
+ * })
23
+ *
24
+ * // Static usage
25
+ * const { txHash, txPacked } = TransactionBuilder.buildTransfer({
26
+ * senderPrivkey: '5Kd3N...',
27
+ * recipient: '5Kd3N...',
28
+ * amount: 10.5,
29
+ * symbol: 'AMA'
30
+ * })
31
+ * ```
32
+ */
33
+ export declare class TransactionBuilder {
34
+ private readonly privateKey;
35
+ private signerPk;
36
+ private signerSk;
37
+ /**
38
+ * Domain Separation Tag for transaction signatures
39
+ */
40
+ private static readonly TX_DST;
41
+ /**
42
+ * Create a new TransactionBuilder instance
43
+ *
44
+ * @param privateKey - Optional Base58 encoded private key (seed). If provided,
45
+ * the builder will use this key for all transactions.
46
+ */
47
+ constructor(privateKey?: string);
48
+ /**
49
+ * Generate a transaction nonce based on current timestamp
50
+ */
51
+ private static generateNonce;
52
+ /**
53
+ * Create transaction structure
54
+ */
55
+ private static createTransaction;
56
+ /**
57
+ * Build an unsigned transaction (returns transaction structure and hash)
58
+ */
59
+ private static buildUnsignedTransaction;
60
+ /**
61
+ * Normalize signer secret key to PrivKey format (handles Base58 strings)
62
+ */
63
+ private static normalizeSignerSk;
64
+ /**
65
+ * Sign a transaction hash using BLS12-381 with transaction DST
66
+ */
67
+ private static signHash;
68
+ /**
69
+ * Sign an unsigned transaction
70
+ */
71
+ private static signTransaction;
72
+ /**
73
+ * Build and sign a transaction (convenience method)
74
+ */
75
+ private static buildAndSignTransaction;
76
+ /**
77
+ * Initialize signer keys from the private key
78
+ */
79
+ private initializeKeys;
80
+ /**
81
+ * Build an unsigned transaction
82
+ *
83
+ * @param contract - Contract name
84
+ * @param method - Method name
85
+ * @param args - Method arguments
86
+ * @param signerPk - Optional signer's public key (required if instance has no private key)
87
+ * @returns Unsigned transaction with hash
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const builder = new TransactionBuilder('5Kd3N...')
92
+ * const unsignedTx = builder.build('Coin', 'transfer', [
93
+ * recipientBytes,
94
+ * '1000000000',
95
+ * 'AMA'
96
+ * ])
97
+ * // Can inspect or modify before signing
98
+ * const { txHash, txPacked } = builder.sign(unsignedTx)
99
+ * ```
100
+ */
101
+ build(contract: string, method: string, args: SerializableValue[], signerPk?: Uint8Array): UnsignedTransactionWithHash;
102
+ /**
103
+ * Get the signer's secret key (normalizes to PrivKey format)
104
+ * Handles Base58 strings, PrivKey (Uint8Array), or uses cached/derived key
105
+ */
106
+ private getSignerSk;
107
+ /**
108
+ * Sign an unsigned transaction
109
+ *
110
+ * @param unsignedTx - Unsigned transaction with hash
111
+ * @param signerSk - Optional signer's secret key (required if instance has no private key)
112
+ * @returns Transaction hash and packed transaction
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const builder = new TransactionBuilder('5Kd3N...')
117
+ * const unsignedTx = builder.build('Coin', 'transfer', args)
118
+ * const { txHash, txPacked } = builder.sign(unsignedTx)
119
+ * ```
120
+ */
121
+ sign(unsignedTx: UnsignedTransactionWithHash, signerSk?: PrivKey | string | Uint8Array): BuildTransactionResult;
122
+ /**
123
+ * Build and sign a generic transaction (convenience method)
124
+ *
125
+ * @param contract - Contract name
126
+ * @param method - Method name
127
+ * @param args - Method arguments
128
+ * @param signerPk - Optional signer's public key (required if instance has no private key)
129
+ * @param signerSk - Optional signer's secret key (required if instance has no private key)
130
+ * @returns Transaction hash and packed transaction
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const builder = new TransactionBuilder('5Kd3N...')
135
+ * const { txHash, txPacked } = builder.buildAndSign('Coin', 'transfer', [
136
+ * recipientBytes,
137
+ * '1000000000',
138
+ * 'AMA'
139
+ * ])
140
+ * ```
141
+ */
142
+ buildAndSign(contract: string, method: string, args: SerializableValue[], signerPk?: Uint8Array, signerSk?: PrivKey | string | Uint8Array): BuildTransactionResult;
143
+ /**
144
+ * Build an unsigned transfer transaction
145
+ *
146
+ * @param input - Transfer transaction parameters
147
+ * @returns Unsigned transaction with hash
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const builder = new TransactionBuilder('5Kd3N...')
152
+ * const unsignedTx = builder.buildTransfer({
153
+ * recipient: '5Kd3N...',
154
+ * amount: 10.5,
155
+ * symbol: 'AMA'
156
+ * })
157
+ * ```
158
+ */
159
+ buildTransfer(input: Omit<TransferTransactionInput, 'senderPrivkey'>): UnsignedTransactionWithHash;
160
+ /**
161
+ * Build and sign a transfer transaction (convenience method)
162
+ *
163
+ * @param input - Transfer transaction parameters
164
+ * @returns Transaction hash and packed transaction
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * const builder = new TransactionBuilder('5Kd3N...')
169
+ * const { txHash, txPacked } = builder.transfer({
170
+ * recipient: '5Kd3N...',
171
+ * amount: 10.5,
172
+ * symbol: 'AMA'
173
+ * })
174
+ * ```
175
+ */
176
+ transfer(input: Omit<TransferTransactionInput, 'senderPrivkey'>): BuildTransactionResult;
177
+ /**
178
+ * Build an unsigned transfer transaction (static method)
179
+ *
180
+ * @param input - Transfer transaction parameters (without senderPrivkey)
181
+ * @param signerPk - Signer's public key
182
+ * @returns Unsigned transaction with hash
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const unsignedTx = TransactionBuilder.buildTransfer(
187
+ * { recipient: '5Kd3N...', amount: 10.5, symbol: 'AMA' },
188
+ * publicKey
189
+ * )
190
+ * ```
191
+ */
192
+ static buildTransfer(input: Omit<TransferTransactionInput, 'senderPrivkey'>, signerPk: Uint8Array): UnsignedTransactionWithHash;
193
+ /**
194
+ * Build and sign a transfer transaction (static method)
195
+ *
196
+ * @param input - Transfer transaction parameters
197
+ * @returns Transaction hash and packed transaction
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const { txHash, txPacked } = TransactionBuilder.buildSignedTransfer({
202
+ * senderPrivkey: '5Kd3N...',
203
+ * recipient: '5Kd3N...',
204
+ * amount: 10.5,
205
+ * symbol: 'AMA'
206
+ * })
207
+ * ```
208
+ */
209
+ static buildSignedTransfer(input: TransferTransactionInput): BuildTransactionResult;
210
+ /**
211
+ * Build an unsigned transaction (static method)
212
+ *
213
+ * @param signerPk - Signer's public key
214
+ * @param contract - Contract name
215
+ * @param method - Method name
216
+ * @param args - Method arguments
217
+ * @returns Unsigned transaction with hash
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * const unsignedTx = TransactionBuilder.build(
222
+ * publicKey,
223
+ * 'Coin',
224
+ * 'transfer',
225
+ * [recipientBytes, amount, 'AMA']
226
+ * )
227
+ * ```
228
+ */
229
+ static build(signerPk: Uint8Array, contract: string, method: string, args: SerializableValue[]): UnsignedTransactionWithHash;
230
+ /**
231
+ * Sign an unsigned transaction (static method)
232
+ *
233
+ * @param unsignedTx - Unsigned transaction with hash
234
+ * @param signerSk - Signer's secret key
235
+ * @returns Transaction hash and packed transaction
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * const unsignedTx = TransactionBuilder.build(publicKey, 'Coin', 'transfer', args)
240
+ * const { txHash, txPacked } = TransactionBuilder.sign(unsignedTx, secretKey)
241
+ * ```
242
+ */
243
+ static sign(unsignedTx: UnsignedTransactionWithHash, signerSk: PrivKey | string | Uint8Array): BuildTransactionResult;
244
+ /**
245
+ * Build and sign a generic transaction (static method)
246
+ *
247
+ * @param signerPk - Signer's public key
248
+ * @param signerSk - Signer's secret key
249
+ * @param contract - Contract name
250
+ * @param method - Method name
251
+ * @param args - Method arguments
252
+ * @returns Transaction hash and packed transaction
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * const { txHash, txPacked } = TransactionBuilder.buildAndSign(
257
+ * publicKey,
258
+ * secretKey,
259
+ * 'Coin',
260
+ * 'transfer',
261
+ * [recipientBytes, amount, 'AMA']
262
+ * )
263
+ * ```
264
+ */
265
+ static buildAndSign(signerPk: Uint8Array, signerSk: PrivKey | string | Uint8Array, contract: string, method: string, args: SerializableValue[]): BuildTransactionResult;
266
+ }
267
+ //# sourceMappingURL=transaction-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-builder.d.ts","sourceRoot":"","sources":["../src/transaction-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,KAAK,EACX,sBAAsB,EACtB,iBAAiB,EAEjB,wBAAwB,EAExB,2BAA2B,EAC3B,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,QAAQ,CAAuB;IAEvC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAmD;IAEjF;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,MAAM;IAO/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAmBhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAavC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAUhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ;IAKvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAW9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgBtC;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;;;;;;;;;;;;;;;;;;;OAoB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AI,CACV,UAAU,EAAE,2BAA2B,EACvC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GACrC,sBAAsB;IAIzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,YAAY,CAClB,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,EACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,EAAE,GACvB,sBAAsB;CASzB"}
@@ -0,0 +1,397 @@
1
+ /**
2
+ * Transaction Builder
3
+ *
4
+ * This module provides a class-based API for building and signing Amadeus protocol transactions.
5
+ */
6
+ import { bls12_381 as bls } from '@noble/curves/bls12-381';
7
+ import { sha256 } from '@noble/hashes/sha2';
8
+ import { deriveSkAndSeed64FromBase58Seed, getPublicKey } from './crypto';
9
+ import { fromBase58, toBase58 } from './encoding';
10
+ import { toAtomicAma } from './conversion';
11
+ import { encode } from './serialization';
12
+ /**
13
+ * Transaction Builder for Amadeus Protocol
14
+ *
15
+ * Provides methods for building and signing transactions. Can be instantiated
16
+ * with a private key for convenience, or used statically.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Instance-based usage
21
+ * const builder = new TransactionBuilder('5Kd3N...')
22
+ * const { txHash, txPacked } = builder.transfer({
23
+ * recipient: '5Kd3N...',
24
+ * amount: 10.5,
25
+ * symbol: 'AMA'
26
+ * })
27
+ *
28
+ * // Static usage
29
+ * const { txHash, txPacked } = TransactionBuilder.buildTransfer({
30
+ * senderPrivkey: '5Kd3N...',
31
+ * recipient: '5Kd3N...',
32
+ * amount: 10.5,
33
+ * symbol: 'AMA'
34
+ * })
35
+ * ```
36
+ */
37
+ export class TransactionBuilder {
38
+ privateKey;
39
+ signerPk = null;
40
+ signerSk = null;
41
+ /**
42
+ * Domain Separation Tag for transaction signatures
43
+ */
44
+ static TX_DST = 'AMADEUS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_TX_';
45
+ /**
46
+ * Create a new TransactionBuilder instance
47
+ *
48
+ * @param privateKey - Optional Base58 encoded private key (seed). If provided,
49
+ * the builder will use this key for all transactions.
50
+ */
51
+ constructor(privateKey) {
52
+ this.privateKey = privateKey || null;
53
+ if (this.privateKey) {
54
+ this.initializeKeys();
55
+ }
56
+ }
57
+ /**
58
+ * Generate a transaction nonce based on current timestamp
59
+ */
60
+ static generateNonce() {
61
+ return BigInt(Date.now()) * 1000000n;
62
+ }
63
+ /**
64
+ * Create transaction structure
65
+ */
66
+ static createTransaction(signer, contract, method, args) {
67
+ const action = {
68
+ op: 'call',
69
+ contract,
70
+ function: method,
71
+ args
72
+ };
73
+ return {
74
+ signer,
75
+ nonce: TransactionBuilder.generateNonce(),
76
+ action
77
+ };
78
+ }
79
+ /**
80
+ * Build an unsigned transaction (returns transaction structure and hash)
81
+ */
82
+ static buildUnsignedTransaction(signerPk, contract, method, args) {
83
+ const tx = TransactionBuilder.createTransaction(signerPk, contract, method, args);
84
+ const txEncoded = encode(tx);
85
+ const hash = sha256(txEncoded);
86
+ return { tx, hash };
87
+ }
88
+ /**
89
+ * Normalize signer secret key to PrivKey format (handles Base58 strings)
90
+ */
91
+ static normalizeSignerSk(signerSk) {
92
+ if (typeof signerSk === 'string') {
93
+ // Base58 string - derive PrivKey from it
94
+ const { sk } = deriveSkAndSeed64FromBase58Seed(signerSk);
95
+ return sk;
96
+ }
97
+ // Already PrivKey (Uint8Array)
98
+ return signerSk;
99
+ }
100
+ /**
101
+ * Sign a transaction hash using BLS12-381 with transaction DST
102
+ */
103
+ static signHash(hash, signerSk) {
104
+ const normalizedSk = TransactionBuilder.normalizeSignerSk(signerSk);
105
+ return bls.sign(hash, normalizedSk, { DST: TransactionBuilder.TX_DST });
106
+ }
107
+ /**
108
+ * Sign an unsigned transaction
109
+ */
110
+ static signTransaction(unsignedTx, signerSk) {
111
+ const signature = TransactionBuilder.signHash(unsignedTx.hash, signerSk);
112
+ return {
113
+ txHash: toBase58(unsignedTx.hash),
114
+ txPacked: encode({ tx: unsignedTx.tx, hash: unsignedTx.hash, signature })
115
+ };
116
+ }
117
+ /**
118
+ * Build and sign a transaction (convenience method)
119
+ */
120
+ static buildAndSignTransaction(signerPk, signerSk, contract, method, args) {
121
+ const unsignedTx = TransactionBuilder.buildUnsignedTransaction(signerPk, contract, method, args);
122
+ return TransactionBuilder.signTransaction(unsignedTx, signerSk);
123
+ }
124
+ /**
125
+ * Initialize signer keys from the private key
126
+ */
127
+ initializeKeys() {
128
+ if (!this.privateKey) {
129
+ throw new Error('Private key not set');
130
+ }
131
+ const { seed64, sk } = deriveSkAndSeed64FromBase58Seed(this.privateKey);
132
+ this.signerPk = getPublicKey(seed64);
133
+ this.signerSk = sk;
134
+ }
135
+ /**
136
+ * Build an unsigned transaction
137
+ *
138
+ * @param contract - Contract name
139
+ * @param method - Method name
140
+ * @param args - Method arguments
141
+ * @param signerPk - Optional signer's public key (required if instance has no private key)
142
+ * @returns Unsigned transaction with hash
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * const builder = new TransactionBuilder('5Kd3N...')
147
+ * const unsignedTx = builder.build('Coin', 'transfer', [
148
+ * recipientBytes,
149
+ * '1000000000',
150
+ * 'AMA'
151
+ * ])
152
+ * // Can inspect or modify before signing
153
+ * const { txHash, txPacked } = builder.sign(unsignedTx)
154
+ * ```
155
+ */
156
+ build(contract, method, args, signerPk) {
157
+ const pk = signerPk || this.signerPk;
158
+ if (!pk) {
159
+ throw new Error('Signer public key required. Provide key or initialize builder with private key.');
160
+ }
161
+ return TransactionBuilder.buildUnsignedTransaction(pk, contract, method, args);
162
+ }
163
+ /**
164
+ * Get the signer's secret key (normalizes to PrivKey format)
165
+ * Handles Base58 strings, PrivKey (Uint8Array), or uses cached/derived key
166
+ */
167
+ getSignerSk(signerSk) {
168
+ // If provided, normalize it (convert Base58 string to PrivKey if needed)
169
+ if (signerSk) {
170
+ if (typeof signerSk === 'string') {
171
+ // Base58 string - derive PrivKey from it
172
+ const { sk } = deriveSkAndSeed64FromBase58Seed(signerSk);
173
+ return sk;
174
+ }
175
+ // Already PrivKey (Uint8Array)
176
+ return signerSk;
177
+ }
178
+ // Use cached signerSk if available
179
+ if (this.signerSk) {
180
+ return this.signerSk;
181
+ }
182
+ // Derive from privateKey
183
+ if (this.privateKey) {
184
+ const { sk } = deriveSkAndSeed64FromBase58Seed(this.privateKey);
185
+ return sk;
186
+ }
187
+ throw new Error('Secret key required for signing');
188
+ }
189
+ /**
190
+ * Sign an unsigned transaction
191
+ *
192
+ * @param unsignedTx - Unsigned transaction with hash
193
+ * @param signerSk - Optional signer's secret key (required if instance has no private key)
194
+ * @returns Transaction hash and packed transaction
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * const builder = new TransactionBuilder('5Kd3N...')
199
+ * const unsignedTx = builder.build('Coin', 'transfer', args)
200
+ * const { txHash, txPacked } = builder.sign(unsignedTx)
201
+ * ```
202
+ */
203
+ sign(unsignedTx, signerSk) {
204
+ const sk = this.getSignerSk(signerSk);
205
+ return TransactionBuilder.signTransaction(unsignedTx, sk);
206
+ }
207
+ /**
208
+ * Build and sign a generic transaction (convenience method)
209
+ *
210
+ * @param contract - Contract name
211
+ * @param method - Method name
212
+ * @param args - Method arguments
213
+ * @param signerPk - Optional signer's public key (required if instance has no private key)
214
+ * @param signerSk - Optional signer's secret key (required if instance has no private key)
215
+ * @returns Transaction hash and packed transaction
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * const builder = new TransactionBuilder('5Kd3N...')
220
+ * const { txHash, txPacked } = builder.buildAndSign('Coin', 'transfer', [
221
+ * recipientBytes,
222
+ * '1000000000',
223
+ * 'AMA'
224
+ * ])
225
+ * ```
226
+ */
227
+ buildAndSign(contract, method, args, signerPk, signerSk) {
228
+ const pk = signerPk || this.signerPk;
229
+ if (!pk) {
230
+ throw new Error('Signer public key required. Provide key or initialize builder with private key.');
231
+ }
232
+ const sk = this.getSignerSk(signerSk);
233
+ return TransactionBuilder.buildAndSignTransaction(pk, sk, contract, method, args);
234
+ }
235
+ /**
236
+ * Build an unsigned transfer transaction
237
+ *
238
+ * @param input - Transfer transaction parameters
239
+ * @returns Unsigned transaction with hash
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * const builder = new TransactionBuilder('5Kd3N...')
244
+ * const unsignedTx = builder.buildTransfer({
245
+ * recipient: '5Kd3N...',
246
+ * amount: 10.5,
247
+ * symbol: 'AMA'
248
+ * })
249
+ * ```
250
+ */
251
+ buildTransfer(input) {
252
+ if (!this.signerPk) {
253
+ throw new Error('Public key required. Initialize builder with private key or provide signerPk.');
254
+ }
255
+ return this.build('Coin', 'transfer', [
256
+ fromBase58(input.recipient),
257
+ toAtomicAma(input.amount).toString(),
258
+ input.symbol
259
+ ]);
260
+ }
261
+ /**
262
+ * Build and sign a transfer transaction (convenience method)
263
+ *
264
+ * @param input - Transfer transaction parameters
265
+ * @returns Transaction hash and packed transaction
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * const builder = new TransactionBuilder('5Kd3N...')
270
+ * const { txHash, txPacked } = builder.transfer({
271
+ * recipient: '5Kd3N...',
272
+ * amount: 10.5,
273
+ * symbol: 'AMA'
274
+ * })
275
+ * ```
276
+ */
277
+ transfer(input) {
278
+ if (!this.privateKey) {
279
+ throw new Error('Private key required. Initialize builder with private key or use static method.');
280
+ }
281
+ return this.buildAndSign('Coin', 'transfer', [
282
+ fromBase58(input.recipient),
283
+ toAtomicAma(input.amount).toString(),
284
+ input.symbol
285
+ ]);
286
+ }
287
+ /**
288
+ * Build an unsigned transfer transaction (static method)
289
+ *
290
+ * @param input - Transfer transaction parameters (without senderPrivkey)
291
+ * @param signerPk - Signer's public key
292
+ * @returns Unsigned transaction with hash
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * const unsignedTx = TransactionBuilder.buildTransfer(
297
+ * { recipient: '5Kd3N...', amount: 10.5, symbol: 'AMA' },
298
+ * publicKey
299
+ * )
300
+ * ```
301
+ */
302
+ static buildTransfer(input, signerPk) {
303
+ return TransactionBuilder.buildUnsignedTransaction(signerPk, 'Coin', 'transfer', [
304
+ fromBase58(input.recipient),
305
+ toAtomicAma(input.amount).toString(),
306
+ input.symbol
307
+ ]);
308
+ }
309
+ /**
310
+ * Build and sign a transfer transaction (static method)
311
+ *
312
+ * @param input - Transfer transaction parameters
313
+ * @returns Transaction hash and packed transaction
314
+ *
315
+ * @example
316
+ * ```ts
317
+ * const { txHash, txPacked } = TransactionBuilder.buildSignedTransfer({
318
+ * senderPrivkey: '5Kd3N...',
319
+ * recipient: '5Kd3N...',
320
+ * amount: 10.5,
321
+ * symbol: 'AMA'
322
+ * })
323
+ * ```
324
+ */
325
+ static buildSignedTransfer(input) {
326
+ const { seed64, sk } = deriveSkAndSeed64FromBase58Seed(input.senderPrivkey);
327
+ const signerPubKey = getPublicKey(seed64);
328
+ return TransactionBuilder.buildAndSignTransaction(signerPubKey, sk, 'Coin', 'transfer', [
329
+ fromBase58(input.recipient),
330
+ toAtomicAma(input.amount).toString(),
331
+ input.symbol
332
+ ]);
333
+ }
334
+ /**
335
+ * Build an unsigned transaction (static method)
336
+ *
337
+ * @param signerPk - Signer's public key
338
+ * @param contract - Contract name
339
+ * @param method - Method name
340
+ * @param args - Method arguments
341
+ * @returns Unsigned transaction with hash
342
+ *
343
+ * @example
344
+ * ```ts
345
+ * const unsignedTx = TransactionBuilder.build(
346
+ * publicKey,
347
+ * 'Coin',
348
+ * 'transfer',
349
+ * [recipientBytes, amount, 'AMA']
350
+ * )
351
+ * ```
352
+ */
353
+ static build(signerPk, contract, method, args) {
354
+ return TransactionBuilder.buildUnsignedTransaction(signerPk, contract, method, args);
355
+ }
356
+ /**
357
+ * Sign an unsigned transaction (static method)
358
+ *
359
+ * @param unsignedTx - Unsigned transaction with hash
360
+ * @param signerSk - Signer's secret key
361
+ * @returns Transaction hash and packed transaction
362
+ *
363
+ * @example
364
+ * ```ts
365
+ * const unsignedTx = TransactionBuilder.build(publicKey, 'Coin', 'transfer', args)
366
+ * const { txHash, txPacked } = TransactionBuilder.sign(unsignedTx, secretKey)
367
+ * ```
368
+ */
369
+ static sign(unsignedTx, signerSk) {
370
+ return TransactionBuilder.signTransaction(unsignedTx, signerSk);
371
+ }
372
+ /**
373
+ * Build and sign a generic transaction (static method)
374
+ *
375
+ * @param signerPk - Signer's public key
376
+ * @param signerSk - Signer's secret key
377
+ * @param contract - Contract name
378
+ * @param method - Method name
379
+ * @param args - Method arguments
380
+ * @returns Transaction hash and packed transaction
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * const { txHash, txPacked } = TransactionBuilder.buildAndSign(
385
+ * publicKey,
386
+ * secretKey,
387
+ * 'Coin',
388
+ * 'transfer',
389
+ * [recipientBytes, amount, 'AMA']
390
+ * )
391
+ * ```
392
+ */
393
+ static buildAndSign(signerPk, signerSk, contract, method, args) {
394
+ return TransactionBuilder.buildAndSignTransaction(signerPk, signerSk, contract, method, args);
395
+ }
396
+ }
397
+ //# sourceMappingURL=transaction-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-builder.js","sourceRoot":"","sources":["../src/transaction-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,+BAA+B,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAUxC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,kBAAkB;IACb,UAAU,CAAe;IAClC,QAAQ,GAAsB,IAAI,CAAA;IAClC,QAAQ,GAAmB,IAAI,CAAA;IAEvC;;OAEG;IACK,MAAM,CAAU,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