@ledgerhq/coin-module-framework 0.1.9 → 1.0.5

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 (108) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/lib/api/errors.d.ts +4 -0
  3. package/lib/api/errors.d.ts.map +1 -0
  4. package/lib/api/errors.js +10 -0
  5. package/lib/api/errors.js.map +1 -0
  6. package/lib/api/index.d.ts +7 -0
  7. package/lib/api/index.d.ts.map +1 -0
  8. package/lib/api/index.js +23 -0
  9. package/lib/api/index.js.map +1 -0
  10. package/lib/api/types.d.ts +568 -0
  11. package/lib/api/types.d.ts.map +1 -0
  12. package/lib/api/types.js +3 -0
  13. package/lib/api/types.js.map +1 -0
  14. package/lib/config.d.ts +43 -0
  15. package/lib/config.d.ts.map +1 -0
  16. package/lib/config.js +21 -0
  17. package/lib/config.js.map +1 -0
  18. package/lib/currencies/formatCurrencyUnit.d.ts +2 -0
  19. package/lib/currencies/formatCurrencyUnit.d.ts.map +1 -0
  20. package/lib/currencies/formatCurrencyUnit.js +7 -0
  21. package/lib/currencies/formatCurrencyUnit.js.map +1 -0
  22. package/lib/currencies/index.d.ts +3 -0
  23. package/lib/currencies/index.d.ts.map +1 -0
  24. package/lib/currencies/index.js +9 -0
  25. package/lib/currencies/index.js.map +1 -0
  26. package/lib/currencies/parseCurrencyUnit.d.ts +2 -0
  27. package/lib/currencies/parseCurrencyUnit.d.ts.map +1 -0
  28. package/lib/currencies/parseCurrencyUnit.js +6 -0
  29. package/lib/currencies/parseCurrencyUnit.js.map +1 -0
  30. package/lib/errors.d.ts +5 -0
  31. package/lib/errors.d.ts.map +1 -0
  32. package/lib/errors.js +7 -0
  33. package/lib/errors.js.map +1 -0
  34. package/lib/features/types.d.ts +46 -0
  35. package/lib/features/types.d.ts.map +1 -0
  36. package/lib/features/types.js +18 -0
  37. package/lib/features/types.js.map +1 -0
  38. package/lib/index.d.ts +6 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +40 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/setup.d.ts +2 -0
  43. package/lib/setup.d.ts.map +1 -0
  44. package/lib/setup.js +6 -0
  45. package/lib/setup.js.map +1 -0
  46. package/lib/test/utils.d.ts +20 -0
  47. package/lib/test/utils.d.ts.map +1 -0
  48. package/lib/test/utils.js +3 -0
  49. package/lib/test/utils.js.map +1 -0
  50. package/lib/utils.d.ts +6 -0
  51. package/lib/utils.d.ts.map +1 -0
  52. package/lib/utils.js +18 -0
  53. package/lib/utils.js.map +1 -0
  54. package/lib-es/api/errors.d.ts +4 -0
  55. package/lib-es/api/errors.d.ts.map +1 -0
  56. package/lib-es/api/errors.js +6 -0
  57. package/lib-es/api/errors.js.map +1 -0
  58. package/lib-es/api/index.d.ts +7 -0
  59. package/lib-es/api/index.d.ts.map +1 -0
  60. package/lib-es/api/index.js +7 -0
  61. package/lib-es/api/index.js.map +1 -0
  62. package/lib-es/api/types.d.ts +568 -0
  63. package/lib-es/api/types.d.ts.map +1 -0
  64. package/lib-es/api/types.js +2 -0
  65. package/lib-es/api/types.js.map +1 -0
  66. package/lib-es/config.d.ts +43 -0
  67. package/lib-es/config.d.ts.map +1 -0
  68. package/lib-es/config.js +19 -0
  69. package/lib-es/config.js.map +1 -0
  70. package/lib-es/currencies/formatCurrencyUnit.d.ts +2 -0
  71. package/lib-es/currencies/formatCurrencyUnit.d.ts.map +1 -0
  72. package/lib-es/currencies/formatCurrencyUnit.js +2 -0
  73. package/lib-es/currencies/formatCurrencyUnit.js.map +1 -0
  74. package/lib-es/currencies/index.d.ts +3 -0
  75. package/lib-es/currencies/index.d.ts.map +1 -0
  76. package/lib-es/currencies/index.js +3 -0
  77. package/lib-es/currencies/index.js.map +1 -0
  78. package/lib-es/currencies/parseCurrencyUnit.d.ts +2 -0
  79. package/lib-es/currencies/parseCurrencyUnit.d.ts.map +1 -0
  80. package/lib-es/currencies/parseCurrencyUnit.js +2 -0
  81. package/lib-es/currencies/parseCurrencyUnit.js.map +1 -0
  82. package/lib-es/errors.d.ts +5 -0
  83. package/lib-es/errors.d.ts.map +1 -0
  84. package/lib-es/errors.js +4 -0
  85. package/lib-es/errors.js.map +1 -0
  86. package/lib-es/features/types.d.ts +46 -0
  87. package/lib-es/features/types.d.ts.map +1 -0
  88. package/lib-es/features/types.js +14 -0
  89. package/lib-es/features/types.js.map +1 -0
  90. package/lib-es/index.d.ts +6 -0
  91. package/lib-es/index.d.ts.map +1 -0
  92. package/lib-es/index.js +5 -0
  93. package/lib-es/index.js.map +1 -0
  94. package/lib-es/setup.d.ts +2 -0
  95. package/lib-es/setup.d.ts.map +1 -0
  96. package/lib-es/setup.js +4 -0
  97. package/lib-es/setup.js.map +1 -0
  98. package/lib-es/test/utils.d.ts +20 -0
  99. package/lib-es/test/utils.d.ts.map +1 -0
  100. package/lib-es/test/utils.js +2 -0
  101. package/lib-es/test/utils.js.map +1 -0
  102. package/lib-es/utils.d.ts +6 -0
  103. package/lib-es/utils.d.ts.map +1 -0
  104. package/lib-es/utils.js +13 -0
  105. package/lib-es/utils.js.map +1 -0
  106. package/package.json +1 -1
  107. package/tsconfig.build.json +5 -2
  108. package/tsconfig.json +1 -1
@@ -0,0 +1,568 @@
1
+ export type BroadcastConfig = {
2
+ mevProtected: boolean;
3
+ sponsored?: boolean;
4
+ source?: TransactionSource;
5
+ };
6
+ /**
7
+ * TransactionSource identifies the origin of a transaction
8
+ */
9
+ export type TransactionSource = {
10
+ type: 'dApp' | 'live-app' | 'coin-module' | 'swap';
11
+ name: string;
12
+ };
13
+ export type BlockInfo = {
14
+ height: number;
15
+ hash: string;
16
+ time: Date;
17
+ parent?: ParentBlock;
18
+ };
19
+ export type ParentBlock = Pick<BlockInfo, 'height' | 'hash'>;
20
+ export type Unit = {
21
+ name: string;
22
+ code: string;
23
+ magnitude: number;
24
+ showAllDigits?: boolean;
25
+ prefixCode?: boolean;
26
+ };
27
+ export type AssetInfo = {
28
+ type: 'native';
29
+ name?: string;
30
+ unit?: Unit;
31
+ } | {
32
+ type: string;
33
+ assetReference?: string;
34
+ assetOwner?: string;
35
+ name?: string;
36
+ unit?: Unit;
37
+ };
38
+ export type Operation<MemoType extends Memo = MemoNotSupported> = {
39
+ id: string;
40
+ type: string;
41
+ senders: string[];
42
+ recipients: string[];
43
+ value: bigint;
44
+ asset: AssetInfo;
45
+ /**
46
+ * Optional memo associated with the operation.
47
+ * Use a `Memo` interface like `StringMemo<"text">`, `MapMemo<Kind, Value>`, or `MyMemo`.
48
+ * Defaults to `MemoNotSupported`.
49
+ */
50
+ memo?: MemoType;
51
+ /**
52
+ * Arbitrary per-blockchain extra fields.
53
+ * This can include things like status, error messages, swap info, etc.
54
+ */
55
+ details?: Record<string, unknown>;
56
+ tx: {
57
+ hash: string;
58
+ block: BlockInfo;
59
+ fees: bigint;
60
+ feesPayer?: string;
61
+ date: Date;
62
+ /** If the transaction has failed, fees have been paid but other balance changes are not effective.*/
63
+ failed: boolean;
64
+ };
65
+ };
66
+ export type Transaction = {
67
+ type: string;
68
+ recipient: string;
69
+ amount: bigint;
70
+ fee: bigint;
71
+ } & Record<string, unknown>;
72
+ /**
73
+ * A block along with its {@link BlockTransaction}, not specific to a particular account/address.
74
+ */
75
+ export type Block = {
76
+ /** The block metadata. */
77
+ info: BlockInfo;
78
+ /**
79
+ * The block transactions.
80
+ *
81
+ * It should include at least all transactions where an EOA is involved, however it is OK to ignore other types of
82
+ * transactions that cannot cause balance changes (eg: validator vote transactions on Solana).
83
+ */
84
+ transactions: BlockTransaction[];
85
+ };
86
+ /**
87
+ * A transaction belonging to a {@link Block}, not specific to a particular account/address.
88
+ */
89
+ export type BlockTransaction = {
90
+ /** The transaction hash/digest (globally unique identifier). */
91
+ hash: string;
92
+ /** If the transaction has been failed, fees have been paid but other balance changes are not effective.*/
93
+ failed: boolean;
94
+ /**
95
+ * The operations/instructions included in this transaction.
96
+ *
97
+ * It should include at least all operations where an EOA is involved, however it is OK to ignore other types of
98
+ * operations that cannot cause balance changes (eg: validator vote instructions on Solana).
99
+ *
100
+ * Note that fees are accounted for separately, so operations must not represent fees.
101
+ */
102
+ operations: BlockOperation[];
103
+ /** Network specific details for this transaction. */
104
+ details?: Record<string, unknown>;
105
+ /** The fee amount paid for this transaction, in base unit of the network native coin, always positive or zero. */
106
+ fees: bigint;
107
+ /** The address that paid for this transaction's fees. */
108
+ feesPayer?: string;
109
+ };
110
+ /** An operation belonging to a {@link BlockTransaction}. */
111
+ export type BlockOperation = TransferBlockOperation | OtherBlockOperation;
112
+ /** An asset transfer that occurred in a {@link BlockTransaction}. */
113
+ export type TransferBlockOperation = {
114
+ /** Operation type discriminator. */
115
+ type: 'transfer';
116
+ /** The impacted address (can be sender or recipient based on signum of <code>amount</code>). */
117
+ address: string;
118
+ /** The peer participant in the transfer (optional as it may be not known). */
119
+ peer?: string;
120
+ /** The transferred asset. */
121
+ asset: AssetInfo;
122
+ /**
123
+ * The signed amount of the transfer, i.e. impact of the transfer on <code>address</code> balance (positive for
124
+ * incoming, negative for outgoing).
125
+ */
126
+ amount: bigint;
127
+ };
128
+ /**
129
+ * An unclassified type of operation that occurred in a {@link BlockTransaction}.
130
+ *
131
+ * Implementations are free to partially/completely omit this kind of operations.
132
+ */
133
+ export type OtherBlockOperation = {
134
+ type: 'other';
135
+ } & Record<string, unknown>;
136
+ export type Account = {
137
+ currencyName: string;
138
+ address: string;
139
+ balance: bigint;
140
+ currencyUnit: Unit;
141
+ spendableBalance: bigint;
142
+ };
143
+ /**
144
+ * A component of an account/address balance, for a single asset.
145
+ *
146
+ * @see AlpacaApi#getBalance
147
+ */
148
+ export type Balance = {
149
+ /** The balance value, in base unit of {@link asset} (always positive). */
150
+ value: bigint;
151
+ /** The balance asset. */
152
+ asset: AssetInfo;
153
+ /** The non-spendable part of {@link value} (eg: minimum balance requirement, or reserved for rent). */
154
+ locked?: bigint;
155
+ /** The {@link Stake} this balance is part of, if any. */
156
+ stake?: Stake;
157
+ };
158
+ /** The state of a {@link Stake}. */
159
+ export type StakeState = 'inactive' | 'activating' | 'active' | 'deactivating';
160
+ /**
161
+ * A staking position, for a single address/asset/state.
162
+ *
163
+ * Note that on blockchains that allow heterogeneous assets/states in a single account, a staking account is represented
164
+ * as several {@link Stake}.
165
+ *
166
+ * @see Reward
167
+ * @see AlpacaApi#getStakes
168
+ */
169
+ export type Stake = {
170
+ /** An immutable, globally unique id of the stake. Depending on the blockchain, it could simply be the account address,
171
+ * or a synthetic identifier. */
172
+ uid: string;
173
+ /** The owning account address. Depending on the blockchain, it can be the staking account address or directly the
174
+ * main one. */
175
+ address: string;
176
+ /** The validator/staking pool/delegate address. */
177
+ delegate?: string;
178
+ /** The stake status, see {@link StakeState}. */
179
+ state: StakeState;
180
+ /** UTC date of last state change. */
181
+ stateUpdatedAt?: Date;
182
+ /** UTC date of initial stake creation. */
183
+ createdAt?: Date;
184
+ /** The staked asset. */
185
+ asset: AssetInfo;
186
+ /** The amount owned by the stake, in base unit of {@link asset} (deposits + rewards). */
187
+ amount: bigint;
188
+ /** The part of {@link amount} that was deposited (<code>amount = amount_deposited + amount_rewarded</code>). */
189
+ amountDeposited?: bigint;
190
+ /** The part of {@link amount} that was rewarded (<code>amount = amount_deposited + amount_rewarded</code>). */
191
+ amountRewarded?: bigint;
192
+ /** A free form map of network specific fields. */
193
+ details?: Record<string, unknown>;
194
+ };
195
+ /**
196
+ * A staking reward distribution event.
197
+ *
198
+ * @see Stake
199
+ * @see AlpacaApi#getRewards
200
+ */
201
+ export type Reward = {
202
+ /** {@link Stake#uid} via which this reward was obtained. */
203
+ stake: string;
204
+ /** The reward asset. */
205
+ asset: AssetInfo;
206
+ /** The reward amount. */
207
+ amount: bigint;
208
+ /** UTC date at which reward was effectively credited to the account (not emitted). */
209
+ receivedAt: Date;
210
+ /** If applicable, the transaction hash that distributed the reward. */
211
+ transactionHash?: string;
212
+ /** A free form map of network specific fields. */
213
+ details?: Record<string, unknown>;
214
+ };
215
+ /**
216
+ * Computational payload processed by Blockchains, such as
217
+ * calldata on EVM or instruction data on Solana
218
+ */
219
+ export interface TxData {
220
+ type: string;
221
+ }
222
+ /**
223
+ * Default implementation when no computational payload is supported
224
+ * by the underlying Blockchain
225
+ */
226
+ export interface TxDataNotSupported extends TxData {
227
+ type: 'none';
228
+ }
229
+ /**
230
+ * Implementation with bufferized computational payload
231
+ */
232
+ export interface BufferTxData extends TxData {
233
+ type: 'buffer';
234
+ value: Buffer;
235
+ }
236
+ export interface Memo {
237
+ type: string;
238
+ }
239
+ export interface MemoNotSupported extends Memo {
240
+ type: 'none';
241
+ }
242
+ export interface StringMemo<Kind extends string = 'text'> extends Memo {
243
+ type: 'string';
244
+ kind: Kind;
245
+ value: string;
246
+ }
247
+ export interface MapMemo<Kind extends string, Value> extends Memo {
248
+ type: string;
249
+ memos: Map<Kind, Value>;
250
+ }
251
+ export interface TypedMapMemo<KindToValueMap extends Record<string, unknown>> extends Memo {
252
+ type: string;
253
+ memos: Map<keyof KindToValueMap, KindToValueMap[keyof KindToValueMap]>;
254
+ }
255
+ type MaybeMemo<MemoType extends Memo> = MemoType extends MemoNotSupported ? object : {
256
+ memo: MemoType;
257
+ };
258
+ type MaybeTxData<TxDataType extends TxData> = TxDataType extends TxDataNotSupported ? object : {
259
+ data: TxDataType;
260
+ };
261
+ export type FeesStrategy = 'slow' | 'medium' | 'fast' | 'custom';
262
+ export type StakingOperation = 'delegate' | 'undelegate' | 'redelegate';
263
+ export type TransactionIntent<MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = {
264
+ intentType: 'transaction' | 'staking';
265
+ type: string;
266
+ sender: string;
267
+ recipient: string;
268
+ amount: bigint;
269
+ asset: AssetInfo;
270
+ useAllAmount?: boolean;
271
+ feesStrategy?: FeesStrategy;
272
+ senderPublicKey?: string;
273
+ sequence?: bigint;
274
+ expiration?: number;
275
+ sponsored?: boolean;
276
+ } & MaybeMemo<MemoType> & MaybeTxData<TxDataType>;
277
+ export type StakingTransactionIntent<MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = TransactionIntent & {
278
+ intentType: 'staking';
279
+ mode: StakingOperation;
280
+ valAddress: string;
281
+ dstValAddress?: string;
282
+ } & MaybeMemo<MemoType> & MaybeTxData<TxDataType>;
283
+ export type SendTransactionIntent<MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = TransactionIntent & {
284
+ intentType: 'transaction';
285
+ } & MaybeMemo<MemoType> & MaybeTxData<TxDataType>;
286
+ export type TransactionValidation = {
287
+ errors: Record<string, Error>;
288
+ warnings: Record<string, Error>;
289
+ estimatedFees: bigint;
290
+ totalFees?: bigint;
291
+ amount: bigint;
292
+ totalSpent: bigint;
293
+ };
294
+ export type FeeEstimation = {
295
+ value: bigint;
296
+ parameters?: Record<string, unknown>;
297
+ };
298
+ /** Response of {@link AlpacaApi#craftTransaction}. */
299
+ export type CraftedTransaction = {
300
+ /** The serialized transaction (encoding is blockchain dependent). */
301
+ transaction: string;
302
+ /** Blockchain specific details (eg: UTXOs referenced in the transaction). */
303
+ details?: Record<string, unknown>;
304
+ };
305
+ /** A pagination cursor. */
306
+ export type Cursor = string;
307
+ /** A paginated response. */
308
+ export type Page<T> = {
309
+ items: T[];
310
+ next?: Cursor | undefined;
311
+ };
312
+ /** Options for {@link AlpacaApi#listOperations}. */
313
+ export type ListOperationsOptions = {
314
+ /**
315
+ * The minimum block height for which to fetch operations (inclusive).
316
+ *
317
+ * Implementation must raise a "not supported" error if `minHeight` is non-zero and not supported.
318
+ */
319
+ minHeight: number;
320
+ /**
321
+ * A pagination cursor to resume listing.
322
+ *
323
+ * Implementation must guarantee the cursor is not volatile, i.e. it can be used long after the last request and still
324
+ * provide consistent results - for instance, a date or transaction hash.
325
+ */
326
+ cursor?: Cursor;
327
+ /**
328
+ * The maximum number of operations to fetch (note this is a soft limit, the implementation may return less or more
329
+ * operations to not waste RPC calls).
330
+ *
331
+ * Implementation must raise a "not supported" error if limit is set and not supported.
332
+ */
333
+ limit?: number;
334
+ /**
335
+ * The chronological order of the operations (within one page as well as globally when concatenating all pages).
336
+ *
337
+ * Implementation must raise a "not supported" error if order is set and not supported.
338
+ */
339
+ order?: 'asc' | 'desc';
340
+ };
341
+ /** A network validator */
342
+ export type Validator = {
343
+ /** Address of the validator. */
344
+ address: string;
345
+ /** Human-readable name of the validator. */
346
+ name: string;
347
+ /** Human-readable description of the validator. */
348
+ description?: string | undefined;
349
+ /** URL of the entity running the validator. */
350
+ url?: string | undefined;
351
+ /** URL of the logo for the validator. */
352
+ logo?: string | undefined;
353
+ /** Amount of native asset in the pool (in base unit of chain native currency). */
354
+ balance?: bigint | undefined;
355
+ /** Validator commission (a bigint serialized as a string). */
356
+ commissionRate?: string | undefined;
357
+ /** Validator Annual Percentage Yield (floating point number between 0 and 1). */
358
+ apy?: number | undefined;
359
+ };
360
+ export type AccountInfo = {
361
+ isNewAccount: boolean;
362
+ balance: string;
363
+ ownerCount: number;
364
+ sequence: number;
365
+ };
366
+ export type AddressValidationCurrencyParameters = {
367
+ currencyId: string;
368
+ networkId: number;
369
+ };
370
+ export type AlpacaApi<MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = {
371
+ /**
372
+ * Get the latest block information from the network.
373
+ *
374
+ * This must return the same result as {@link getBlockInfo} for the latest block height.
375
+ *
376
+ * @returns the latest block metadata (height, hash, time)
377
+ * @see getBlockInfo
378
+ * @see getBlock
379
+ */
380
+ lastBlock: () => Promise<BlockInfo>;
381
+ /**
382
+ * Get block information for a specific block height.
383
+ *
384
+ * This must return the same result as {@link lastBlock} for the latest block height.
385
+ *
386
+ * This API is optional and may not be supported on all networks: implementation should raise a "not supported" error
387
+ * in such case.
388
+ *
389
+ * @param height the block height to query
390
+ * @returns the block metadata (height, hash, time)
391
+ * @throws "not supported" if the blockchain does not support querying historical blocks
392
+ */
393
+ getBlockInfo: (height: number) => Promise<BlockInfo>;
394
+ /**
395
+ * Get a full block with all its transactions.
396
+ *
397
+ * This returns the complete block data including all transactions and their operations.
398
+ *
399
+ * This must return the same block info as {@link getBlockInfo} for the same height.
400
+ *
401
+ * This API is optional and may not be supported on all networks: implementation should raise a "not supported" error
402
+ * in such case.
403
+ *
404
+ * @param height the block height to query
405
+ * @returns the complete block with transactions
406
+ * @throws "not supported" if the blockchain does not support querying full blocks
407
+ */
408
+ getBlock: (height: number) => Promise<Block>;
409
+ /**
410
+ * Get the list of validators available on the network.
411
+ * @param cursor a pagination cursor to resume listing (the implementation must guarantee the cursor is not volatile,
412
+ * i.e. it can be used long after the last request and still provide consistent results - for instance,
413
+ * a date or transaction hash).
414
+ * The concrete implementation may return all validators in a single page when the underlying SDK
415
+ * does not provide cursor-based pagination.
416
+ */
417
+ getValidators: (cursor?: Cursor) => Promise<Page<Validator>>;
418
+ /**
419
+ * Get the balance(s) for an address/account.
420
+ *
421
+ * Returns all asset balances associated with the address, including the native asset and any tokens/sub-assets. Each
422
+ * balance includes the total value and optionally locked/staked amounts.
423
+ *
424
+ * If account is not found, implementation must return an empty balance.
425
+ *
426
+ * @param address the account address
427
+ * @returns an array of balances for all assets held by the address
428
+ * @see getStakes
429
+ * @see listOperations
430
+ */
431
+ getBalance: (address: string) => Promise<Balance[]>;
432
+ /**
433
+ * List operations for an address/account.
434
+ *
435
+ * If account is not found, implementation must return an empty result.
436
+ *
437
+ * @param address the owner account address
438
+ * @param options see {@link ListOperationsOptions}
439
+ * @returns a page of operations
440
+ * @see getBalance
441
+ */
442
+ listOperations: (address: string, options: ListOperationsOptions) => Promise<Page<Operation>>;
443
+ /**
444
+ * Get staking positions owned by an address/account.
445
+ *
446
+ * Results are returned in no particular order, in pages that can be of variable size. Page size is controlled by
447
+ * implementation and should minimize number of RPC calls (typically by aligning with SDK/RPC API pages).
448
+ *
449
+ * Results could include closed/deleted staking positions, this is implementation dependent.
450
+ *
451
+ * Since this API can make no sense/be complex to implement/require too many RPC calls on some blockchains, it is
452
+ * optional: implementation should raise a "not supported" error in such case.
453
+ *
454
+ * @param address the owner account address
455
+ * @param cursor a pagination cursor to resume listing (the implementation must guarantee the cursor is not volatile,
456
+ * i.e. it can be used long after the last request and still provide consistent results - for instance,
457
+ * a date or transaction hash)
458
+ * @see getBalance
459
+ * @see getRewards
460
+ */
461
+ getStakes: (address: string, cursor?: Cursor) => Promise<Page<Stake>>;
462
+ /**
463
+ * Get staking reward distribution events since address/account inception.
464
+ *
465
+ * Results are returned in ascending chronological order, in pages that can be of variable size. Page size is
466
+ * controlled by implementation and should minimize number of RPC calls (typically by aligning with SDK/RPC API pages).
467
+ *
468
+ * Note that since staking implementations vary from one blockchain to another, some points are implementation dependent:
469
+ * - depending on the blockchain account model, the exact meaning of <code>address</code> can be:
470
+ * - a parent account => history will include all staking subaccounts
471
+ * - a single staking position/subaccount address
472
+ * - depending on the reward distribution mechanisms, reward events can be transactions, or blocks/epochs, or
473
+ * generated synthetically (eg: daily)
474
+ *
475
+ * Since this API can make no sense/be complex to implement/require too many RPC calls on some blockchains, it is
476
+ * optional: implementation should raise a "not supported" error in such case.
477
+ *
478
+ * @param address the account address (see doc, exact scope of the request is implementation dependent)
479
+ * @param cursor a pagination cursor to resume listing (the implementation must guarantee the cursor is not volatile,
480
+ * i.e. it can be used long after the last request and still provide consistent results - for instance,
481
+ * a date or transaction hash)
482
+ * @see getBalance
483
+ * @see getStakes
484
+ */
485
+ getRewards: (address: string, cursor?: Cursor) => Promise<Page<Reward>>;
486
+ /**
487
+ * Craft an unsigned transaction from a transaction intent.
488
+ *
489
+ * The crafted transaction is ready to be signed by the hardware wallet and then combined
490
+ * with the signature using {@link combine}.
491
+ *
492
+ * @param transactionIntent the transaction intent describing what the user wants to do
493
+ * @param customFees optional custom fees to use instead of the default estimation
494
+ * @returns the crafted transaction with optional blockchain-specific details
495
+ * @see craftRawTransaction
496
+ */
497
+ craftTransaction: (transactionIntent: TransactionIntent<MemoType, TxDataType>, customFees?: FeeEstimation) => Promise<CraftedTransaction>;
498
+ /**
499
+ * Craft an unsigned transaction from a raw/pre-built transaction.
500
+ *
501
+ * This is an alternative to {@link craftTransaction} for cases where the transaction
502
+ * is already built externally (e.g., by a dApp or smart contract interaction).
503
+ *
504
+ * @param transaction the raw transaction to wrap/prepare for signing
505
+ * @param sender the sender address
506
+ * @param publicKey the sender's public key
507
+ * @param sequence the account sequence/nonce (to prevent replay attacks)
508
+ * @returns the crafted transaction ready for signing
509
+ * @throws "not supported" if the blockchain does not support raw transaction crafting
510
+ * @see craftTransaction
511
+ */
512
+ craftRawTransaction: (transaction: string, sender: string, publicKey: string, sequence: bigint) => Promise<CraftedTransaction>;
513
+ /**
514
+ * Estimate the fees for a transaction intent.
515
+ *
516
+ * The estimation should be based on current network conditions (e.g., gas price, fee rate).
517
+ *
518
+ * @param transactionIntent the transaction intent describing what the user wants to do
519
+ * @param customFeesParameters optional blockchain-specific parameters to customize the fee estimation
520
+ * (e.g., gas limit, priority fee)
521
+ * @returns the estimated fees and optional parameters that can be passed to {@link craftTransaction}
522
+ */
523
+ estimateFees: (transactionIntent: TransactionIntent<MemoType, TxDataType>, customFeesParameters?: FeeEstimation['parameters']) => Promise<FeeEstimation>;
524
+ /**
525
+ * Combine a crafted transaction with a signature to produce a signed transaction ready for broadcast.
526
+ *
527
+ * @param tx the unsigned/crafted transaction (as returned by {@link craftTransaction})
528
+ * @param signature the signature produced by the hardware wallet
529
+ * @param pubkey the public key used to sign (required for some blockchains to verify/embed in the transaction)
530
+ * @returns the signed transaction ready for {@link broadcast}
531
+ */
532
+ combine: (tx: string, signature: string, pubkey?: string) => string | Promise<string>;
533
+ /**
534
+ * Broadcast a signed transaction to the network.
535
+ *
536
+ * @param tx the signed transaction (encoding is blockchain dependent, typically hex-encoded)
537
+ * @param broadcastConfig optional configuration for the broadcast (e.g., retry settings)
538
+ * @returns the transaction hash/digest once successfully submitted to the network
539
+ * @throws if the transaction is rejected by the network (e.g., invalid signature, insufficient funds)
540
+ */
541
+ broadcast: (tx: string, broadcastConfig?: BroadcastConfig) => Promise<string>;
542
+ /**
543
+ * Validate a transaction intent.
544
+ *
545
+ * @param transactionIntent the transaction intent describing what the user wants to do
546
+ * @param balances current balances of the intent sender
547
+ * @param customFees optional custom fees to use instead of the default estimation
548
+ * @returns additional values the intent has been validated with, and optional errors/warnings
549
+ */
550
+ validateIntent: (transactionIntent: TransactionIntent<MemoType, TxDataType>, balances: Balance[], customFees?: FeeEstimation) => Promise<TransactionValidation>;
551
+ /**
552
+ * Get the next sequence number (nonce) for an address
553
+ *
554
+ * @param address the account address
555
+ * @returns the next usable sequence number
556
+ */
557
+ getNextSequence: (address: string) => Promise<bigint>;
558
+ /**
559
+ * Validate whether an address is well-formed for the blockchain.
560
+ *
561
+ * @param address the address to validate
562
+ * @param parameters currency-specific validation parameters
563
+ * @returns `true` if the address is valid, `false` otherwise
564
+ */
565
+ validateAddress: (address: string, parameters: Partial<AddressValidationCurrencyParameters>) => Promise<boolean>;
566
+ };
567
+ export {};
568
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAE9B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAA;IAElD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IAIZ,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAA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,iBAAiB,EAAE,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAC1D,oBAAoB,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,KAC/C,OAAO,CAAC,aAAa,CAAC,CAAA;IAE3B;;;;;;;OAOG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAErF;;;;;;;OAOG;IACH,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAE7E;;;;;;;OAOG;IACH,cAAc,EAAE,CACd,iBAAiB,EAAE,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAC1D,QAAQ,EAAE,OAAO,EAAE,EACnB,UAAU,CAAC,EAAE,aAAa,KACvB,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAEnC;;;;;OAKG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAErD;;;;;;OAMG;IACH,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,OAAO,CAAC,mCAAmC,CAAC,KACrD,OAAO,CAAC,OAAO,CAAC,CAAA;CACtB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ import { CryptoCurrency, CryptoCurrencyId } from '@ledgerhq/types-cryptoassets';
2
+ import type { FeatureConfig } from './features/types';
3
+ type ConfigStatus = {
4
+ type: 'active';
5
+ features?: FeatureConfig[];
6
+ } | {
7
+ type: 'under_maintenance';
8
+ message?: string;
9
+ } | {
10
+ type: 'migration';
11
+ chain: CryptoCurrencyId;
12
+ from: string;
13
+ to: string;
14
+ link: string;
15
+ } | {
16
+ type: 'feature_unavailable';
17
+ link: string;
18
+ feature: 'history' | 'swap' | 'token_history' | 'send_and_receive' | 'send' | 'receive' | 'sending_tokens' | 'receiving_tokens' | 'staking' | 'claiming_staking_rewards';
19
+ } | {
20
+ type: 'will_be_deprecated';
21
+ deprecated_date: string;
22
+ link: string;
23
+ } | {
24
+ type: 'deprecated';
25
+ };
26
+ type Banner = {
27
+ isDisplay: boolean;
28
+ bannerText: string;
29
+ bannerLink?: string;
30
+ bannerLinkText?: string;
31
+ };
32
+ export type CurrencyConfig = {
33
+ status: ConfigStatus;
34
+ customBanner?: Banner;
35
+ [key: string]: unknown;
36
+ };
37
+ export type CoinConfig<T extends CurrencyConfig> = (currency?: CryptoCurrency) => T;
38
+ declare function buildCoinConfig<T extends CurrencyConfig>(): {
39
+ setCoinConfig: (config: CoinConfig<T>) => void;
40
+ getCoinConfig: (currency?: CryptoCurrency) => T;
41
+ };
42
+ export default buildCoinConfig;
43
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,KAAK,YAAY,GACb;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;CAC3B,GACD;IACE,IAAI,EAAE,mBAAmB,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,gBAAgB,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,IAAI,EAAE,qBAAqB,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EACH,SAAS,GACT,MAAM,GACN,eAAe,GACf,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,gBAAgB,GAChB,kBAAkB,GAClB,SAAS,GACT,0BAA0B,CAAA;CAC/B,GACD;IACE,IAAI,EAAE,oBAAoB,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAEL,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,KAAK,CAAC,CAAA;AAEnF,iBAAS,eAAe,CAAC,CAAC,SAAS,cAAc;4BAGhB,UAAU,CAAC,CAAC,CAAC,KAAG,IAAI;+BAIjB,cAAc,KAAG,CAAC;EAYrD;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { MissingCoinConfig } from './errors';
2
+ function buildCoinConfig() {
3
+ let coinConfig;
4
+ const setCoinConfig = (config) => {
5
+ coinConfig = config;
6
+ };
7
+ const getCoinConfig = (currency) => {
8
+ if (!coinConfig) {
9
+ throw new MissingCoinConfig();
10
+ }
11
+ return coinConfig(currency);
12
+ };
13
+ return {
14
+ setCoinConfig,
15
+ getCoinConfig,
16
+ };
17
+ }
18
+ export default buildCoinConfig;
19
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AA0D5C,SAAS,eAAe;IACtB,IAAI,UAAqC,CAAA;IAEzC,MAAM,aAAa,GAAG,CAAC,MAAqB,EAAQ,EAAE;QACpD,UAAU,GAAG,MAAM,CAAA;IACrB,CAAC,CAAA;IAED,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAK,EAAE;QACrD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,iBAAiB,EAAE,CAAA;QAC/B,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC7B,CAAC,CAAA;IAED,OAAO;QACL,aAAa;QACb,aAAa;KACd,CAAA;AACH,CAAC;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { formatCurrencyUnit, formatCurrencyUnitFragment, type formatCurrencyUnitOptions, type FormatterValue, } from '@ledgerhq/live-currency-format';
2
+ //# sourceMappingURL=formatCurrencyUnit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatCurrencyUnit.d.ts","sourceRoot":"","sources":["../../src/currencies/formatCurrencyUnit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,cAAc,GACpB,MAAM,gCAAgC,CAAA"}