@ledgerhq/coin-module-framework 11.0.1 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/lib/api/getBlock/assertBlockHeight.d.ts +2 -0
- package/lib/api/getBlock/assertBlockHeight.d.ts.map +1 -0
- package/lib/api/getBlock/assertBlockHeight.js +12 -0
- package/lib/api/getBlock/assertBlockHeight.js.map +1 -0
- package/lib/api/impl.d.ts +22 -3
- package/lib/api/impl.d.ts.map +1 -1
- package/lib/api/impl.js +2 -0
- package/lib/api/impl.js.map +1 -1
- package/lib/api/notSupportedApi.d.ts.map +1 -1
- package/lib/api/notSupportedApi.js +1 -0
- package/lib/api/notSupportedApi.js.map +1 -1
- package/lib/api/types.d.ts +130 -2
- package/lib/api/types.d.ts.map +1 -1
- package/lib/api/withDefaults.d.ts +13 -2
- package/lib/api/withDefaults.d.ts.map +1 -1
- package/lib/api/withDefaults.js +36 -1
- package/lib/api/withDefaults.js.map +1 -1
- package/lib/currencies/formatCurrencyUnit.js +1 -1
- package/lib/currencies/formatCurrencyUnit.js.map +1 -1
- package/lib/currencies/parseCurrencyUnit.js +1 -1
- package/lib/currencies/parseCurrencyUnit.js.map +1 -1
- package/lib/errors.d.ts +37 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +71 -2
- package/lib/errors.js.map +1 -1
- package/lib/promises/promises.d.ts +1 -1
- package/lib/promises/promises.d.ts.map +1 -1
- package/lib/promises/promises.js +1 -1
- package/lib/promises/promises.js.map +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +9 -0
- package/lib/utils.js.map +1 -1
- package/lib-es/api/getBlock/assertBlockHeight.d.ts +2 -0
- package/lib-es/api/getBlock/assertBlockHeight.d.ts.map +1 -0
- package/lib-es/api/getBlock/assertBlockHeight.js +9 -0
- package/lib-es/api/getBlock/assertBlockHeight.js.map +1 -0
- package/lib-es/api/impl.d.ts +22 -3
- package/lib-es/api/impl.d.ts.map +1 -1
- package/lib-es/api/impl.js +2 -0
- package/lib-es/api/impl.js.map +1 -1
- package/lib-es/api/notSupportedApi.d.ts.map +1 -1
- package/lib-es/api/notSupportedApi.js +1 -0
- package/lib-es/api/notSupportedApi.js.map +1 -1
- package/lib-es/api/types.d.ts +130 -2
- package/lib-es/api/types.d.ts.map +1 -1
- package/lib-es/api/withDefaults.d.ts +13 -2
- package/lib-es/api/withDefaults.d.ts.map +1 -1
- package/lib-es/api/withDefaults.js +36 -1
- package/lib-es/api/withDefaults.js.map +1 -1
- package/lib-es/currencies/formatCurrencyUnit.js +1 -1
- package/lib-es/currencies/formatCurrencyUnit.js.map +1 -1
- package/lib-es/currencies/parseCurrencyUnit.js +1 -1
- package/lib-es/currencies/parseCurrencyUnit.js.map +1 -1
- package/lib-es/errors.d.ts +37 -1
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +64 -1
- package/lib-es/errors.js.map +1 -1
- package/lib-es/promises/promises.d.ts +1 -1
- package/lib-es/promises/promises.d.ts.map +1 -1
- package/lib-es/promises/promises.js +1 -1
- package/lib-es/promises/promises.js.map +1 -1
- package/lib-es/utils.d.ts +1 -0
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js +8 -0
- package/lib-es/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/api/getBalance/rejectBalanceOptions.test.ts +8 -0
- package/src/api/getBlock/assertBlockHeight.test.ts +28 -0
- package/src/api/getBlock/assertBlockHeight.ts +10 -0
- package/src/api/impl.test.ts +3 -0
- package/src/api/impl.ts +24 -1
- package/src/api/notSupportedApi.ts +1 -0
- package/src/api/types.ts +155 -3
- package/src/api/withDefaults.test.ts +154 -1
- package/src/api/withDefaults.ts +66 -3
- package/src/currencies/formatCurrencyUnit.test.ts +14 -0
- package/src/currencies/formatCurrencyUnit.ts +1 -1
- package/src/currencies/parseCurrencyUnit.test.ts +5 -0
- package/src/currencies/parseCurrencyUnit.ts +1 -1
- package/src/errors.test.ts +89 -0
- package/src/errors.ts +59 -1
- package/src/promises/promises.test.ts +1 -1
- package/src/promises/promises.ts +1 -1
- package/src/test-utils/capabilities.test.ts +1 -0
- package/src/utils.test.ts +24 -1
- package/src/utils.ts +11 -0
package/lib/errors.d.ts
CHANGED
|
@@ -65,8 +65,44 @@ export declare class UnknownError extends Error {
|
|
|
65
65
|
}
|
|
66
66
|
export declare class BlockNotFoundError extends Error {
|
|
67
67
|
name: string;
|
|
68
|
-
|
|
68
|
+
readonly statusCode = 404;
|
|
69
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export declare class InvalidBlockHeightError extends Error {
|
|
74
|
+
name: string;
|
|
75
|
+
readonly statusCode = 400;
|
|
76
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
77
|
+
cause?: unknown;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export declare class RateLimitError extends Error {
|
|
81
|
+
name: string;
|
|
82
|
+
readonly statusCode = 429;
|
|
83
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
84
|
+
cause?: unknown;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export declare class InvalidExplorerResponse extends Error {
|
|
88
|
+
name: string;
|
|
89
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
90
|
+
cause?: unknown;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export declare class GetBlockInfoError extends Error {
|
|
94
|
+
name: string;
|
|
95
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
96
|
+
cause?: unknown;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export declare class GetBlockError extends Error {
|
|
100
|
+
name: string;
|
|
101
|
+
constructor(message?: string, fields?: Record<string, unknown>, options?: {
|
|
102
|
+
cause?: unknown;
|
|
103
|
+
});
|
|
69
104
|
}
|
|
105
|
+
export declare function statusCodeOf(error: unknown): number | undefined;
|
|
70
106
|
export declare class UnexpectedGetBalanceError extends Error {
|
|
71
107
|
name: string;
|
|
72
108
|
cause: unknown;
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,iBAAkB,SAAQ,KAAK;IACjC,IAAI,SAAsB;gBACvB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IACrC,IAAI,SAA0B;gBAC3B,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,cAAe,SAAQ,KAAK;IAC9B,IAAI,SAAmB;gBACpB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,SAAiB;gBAClB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,UAAW,SAAQ,KAAK;IAC1B,IAAI,SAAe;gBAChB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,cAAe,SAAQ,KAAK;IAC9B,IAAI,SAAmB;gBACpB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,4CAA6C,SAAQ,KAAK;IAC5D,IAAI,SAAiD;gBAClD,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAChC,IAAI,SAAqB;gBACtB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,4CAA6C,SAAQ,KAAK;IAC5D,IAAI,SAAiD;gBAClD,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,yBAA0B,SAAQ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EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAK9F;AAED,qBAAa,aAAc,SAAQ,KAAK;IAC7B,IAAI,SAAkB;gBACnB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAK9F;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAM/D;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IACzC,IAAI,SAA8B;IAC3C,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI9C"}
|
package/lib/errors.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-FileCopyrightText: © 2024 LEDGER SAS
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.UnexpectedGetBalanceError = exports.BlockNotFoundError = exports.UnknownError = exports.NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceFees = exports.InvalidTransactionError = exports.FeeRequired = exports.RecipientRequired = exports.NotEnoughSpendableBalance = exports.NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughBalance = exports.InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddress = exports.FeeTooHigh = exports.FeeNotLoaded = exports.AmountRequired = exports.InvalidParameterError = exports.MissingCoinConfig = void 0;
|
|
5
|
+
exports.UnexpectedGetBalanceError = exports.GetBlockError = exports.GetBlockInfoError = exports.InvalidExplorerResponse = exports.RateLimitError = exports.InvalidBlockHeightError = exports.BlockNotFoundError = exports.UnknownError = exports.NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceFees = exports.InvalidTransactionError = exports.FeeRequired = exports.RecipientRequired = exports.NotEnoughSpendableBalance = exports.NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughBalance = exports.InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddress = exports.FeeTooHigh = exports.FeeNotLoaded = exports.AmountRequired = exports.InvalidParameterError = exports.MissingCoinConfig = void 0;
|
|
6
|
+
exports.statusCodeOf = statusCodeOf;
|
|
6
7
|
class MissingCoinConfig extends Error {
|
|
7
8
|
name = 'MissingCoinConfig';
|
|
8
9
|
constructor(message) {
|
|
@@ -125,11 +126,79 @@ class UnknownError extends Error {
|
|
|
125
126
|
exports.UnknownError = UnknownError;
|
|
126
127
|
class BlockNotFoundError extends Error {
|
|
127
128
|
name = 'BlockNotFoundError';
|
|
128
|
-
|
|
129
|
+
statusCode = 404;
|
|
130
|
+
constructor(message, fields, options) {
|
|
129
131
|
super(message || 'BlockNotFoundError');
|
|
132
|
+
if (fields)
|
|
133
|
+
Object.assign(this, fields);
|
|
134
|
+
if (options?.cause !== undefined)
|
|
135
|
+
Object.assign(this, { cause: options.cause });
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
exports.BlockNotFoundError = BlockNotFoundError;
|
|
139
|
+
class InvalidBlockHeightError extends Error {
|
|
140
|
+
name = 'InvalidBlockHeightError';
|
|
141
|
+
statusCode = 400;
|
|
142
|
+
constructor(message, fields, options) {
|
|
143
|
+
super(message || 'InvalidBlockHeightError');
|
|
144
|
+
if (fields)
|
|
145
|
+
Object.assign(this, fields);
|
|
146
|
+
if (options?.cause !== undefined)
|
|
147
|
+
Object.assign(this, { cause: options.cause });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.InvalidBlockHeightError = InvalidBlockHeightError;
|
|
151
|
+
class RateLimitError extends Error {
|
|
152
|
+
name = 'RateLimitError';
|
|
153
|
+
statusCode = 429;
|
|
154
|
+
constructor(message, fields, options) {
|
|
155
|
+
super(message || 'Upstream rate limit exceeded (429), please retry later');
|
|
156
|
+
if (fields)
|
|
157
|
+
Object.assign(this, fields);
|
|
158
|
+
if (options?.cause !== undefined)
|
|
159
|
+
Object.assign(this, { cause: options.cause });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.RateLimitError = RateLimitError;
|
|
163
|
+
class InvalidExplorerResponse extends Error {
|
|
164
|
+
name = 'InvalidExplorerResponse';
|
|
165
|
+
constructor(message, fields, options) {
|
|
166
|
+
super(message || 'InvalidExplorerResponse');
|
|
167
|
+
if (fields)
|
|
168
|
+
Object.assign(this, fields);
|
|
169
|
+
if (options?.cause !== undefined)
|
|
170
|
+
Object.assign(this, { cause: options.cause });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.InvalidExplorerResponse = InvalidExplorerResponse;
|
|
174
|
+
class GetBlockInfoError extends Error {
|
|
175
|
+
name = 'GetBlockInfoError';
|
|
176
|
+
constructor(message, fields, options) {
|
|
177
|
+
super(message || 'GetBlockInfoError');
|
|
178
|
+
if (fields)
|
|
179
|
+
Object.assign(this, fields);
|
|
180
|
+
if (options?.cause !== undefined)
|
|
181
|
+
Object.assign(this, { cause: options.cause });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.GetBlockInfoError = GetBlockInfoError;
|
|
185
|
+
class GetBlockError extends Error {
|
|
186
|
+
name = 'GetBlockError';
|
|
187
|
+
constructor(message, fields, options) {
|
|
188
|
+
super(message || 'GetBlockError');
|
|
189
|
+
if (fields)
|
|
190
|
+
Object.assign(this, fields);
|
|
191
|
+
if (options?.cause !== undefined)
|
|
192
|
+
Object.assign(this, { cause: options.cause });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.GetBlockError = GetBlockError;
|
|
196
|
+
function statusCodeOf(error) {
|
|
197
|
+
if (error instanceof Error && 'statusCode' in error && typeof error.statusCode === 'number') {
|
|
198
|
+
return error.statusCode;
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
133
202
|
class UnexpectedGetBalanceError extends Error {
|
|
134
203
|
name = 'UnexpectedGetBalanceError';
|
|
135
204
|
cause;
|
package/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAiLtC,oCAMC;AArLD,MAAa,iBAAkB,SAAQ,KAAK;IACjC,IAAI,GAAG,mBAAmB,CAAA;IACnC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC,CAAA;IACvC,CAAC;CACF;AALD,8CAKC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,uBAAuB,CAAA;IACvC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,uBAAuB,CAAC,CAAA;IAC3C,CAAC;CACF;AALD,sDAKC;AAED,MAAa,cAAe,SAAQ,KAAK;IAC9B,IAAI,GAAG,gBAAgB,CAAA;IAChC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAA;IACpC,CAAC;CACF;AALD,wCAKC;AAED,MAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,cAAc,CAAA;IAC9B,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,cAAc,CAAC,CAAA;IAClC,CAAC;CACF;AALD,oCAKC;AAED,MAAa,UAAW,SAAQ,KAAK;IAC1B,IAAI,GAAG,YAAY,CAAA;IAC5B,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,YAAY,CAAC,CAAA;IAChC,CAAC;CACF;AALD,gCAKC;AAED,MAAa,cAAe,SAAQ,KAAK;IAC9B,IAAI,GAAG,gBAAgB,CAAA;IAChC,YAAY,OAAgB,EAAE,MAAgC;QAC5D,KAAK,C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QAC3C,KAAK,CAAC,OAAO,IAAI,2BAA2B,CAAC,CAAA;QAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AARD,8DAQC"}
|
|
@@ -4,7 +4,7 @@ declare const defaults: {
|
|
|
4
4
|
interval: number;
|
|
5
5
|
intervalMultiplicator: number;
|
|
6
6
|
context: string;
|
|
7
|
-
retryCondition: (
|
|
7
|
+
retryCondition: (_error: unknown) => boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function retry<A>(f: () => Promise<A>, options?: Partial<typeof defaults>): Promise<A>;
|
|
10
10
|
export declare function promiseAllBatched<A, B>(batch: number, items: Array<A>, fn: (arg0: A, arg1: number) => Promise<B>): Promise<B[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promises.d.ts","sourceRoot":"","sources":["../../src/promises/promises.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAA0C,CAAA;AAEzF,QAAA,MAAM,QAAQ;;;;;
|
|
1
|
+
{"version":3,"file":"promises.d.ts","sourceRoot":"","sources":["../../src/promises/promises.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAA0C,CAAA;AAEzF,QAAA,MAAM,QAAQ;;;;;6BAKa,OAAO;CACjC,CAAA;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsB5F;AAED,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAC1C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,EAAE,CAAC,CAuBd"}
|
package/lib/promises/promises.js
CHANGED
|
@@ -13,7 +13,7 @@ const defaults = {
|
|
|
13
13
|
interval: 300,
|
|
14
14
|
intervalMultiplicator: 1.5,
|
|
15
15
|
context: '',
|
|
16
|
-
retryCondition: (
|
|
16
|
+
retryCondition: (_error) => true,
|
|
17
17
|
};
|
|
18
18
|
function retry(f, options) {
|
|
19
19
|
const { maxRetry, interval, intervalMultiplicator, retryCondition } = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promises.js","sourceRoot":"","sources":["../../src/promises/promises.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;AACtC,gDAAgD;;;AAYhD,sBAsBC;AAED,8CA2BC;AA7DM,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAA5E,QAAA,KAAK,SAAuE;AAEzF,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,GAAG;IACb,qBAAqB,EAAE,GAAG;IAC1B,OAAO,EAAE,EAAE;IACX,cAAc,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"promises.js","sourceRoot":"","sources":["../../src/promises/promises.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;AACtC,gDAAgD;;;AAYhD,sBAsBC;AAED,8CA2BC;AA7DM,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAA5E,QAAA,KAAK,SAAuE;AAEzF,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,CAAC;IACX,Q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AM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;YAC7B,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACrC,CAAC;QACD,MAAM,IAAI,EAAE,CAAA;IACd,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;SACjC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;SACrB,GAAG,CAAC,IAAI,CAAC,CACb,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare function fromBigNumberToBigInt(bigNumber: BigNumber | undefined):
|
|
|
4
4
|
export declare function fromBigNumberToBigInt(bigNumber: BigNumber | undefined, defaultValue: bigint): bigint;
|
|
5
5
|
export declare function isSendTransactionIntent(tx: TransactionIntent): tx is SendTransactionIntent;
|
|
6
6
|
export declare function isStakingTransactionIntent(tx: TransactionIntent): tx is StakingTransactionIntent;
|
|
7
|
+
export declare function isHttpTooManyRequests(error: unknown): boolean;
|
|
7
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAC3F,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,YAAY,EAAE,MAAM,GACnB,MAAM,CAAA;AAWT,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,iBAAiB,GAAG,EAAE,IAAI,qBAAqB,CAE1F;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,iBAAiB,GAAG,EAAE,IAAI,wBAAwB,CAEhG"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAC3F,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,YAAY,EAAE,MAAM,GACnB,MAAM,CAAA;AAWT,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,iBAAiB,GAAG,EAAE,IAAI,qBAAqB,CAE1F;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,iBAAiB,GAAG,EAAE,IAAI,wBAAwB,CAEhG;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS7D"}
|
package/lib/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.fromBigNumberToBigInt = fromBigNumberToBigInt;
|
|
9
9
|
exports.isSendTransactionIntent = isSendTransactionIntent;
|
|
10
10
|
exports.isStakingTransactionIntent = isStakingTransactionIntent;
|
|
11
|
+
exports.isHttpTooManyRequests = isHttpTooManyRequests;
|
|
11
12
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
12
13
|
function fromBigNumberToBigInt(bigNumber, defaultValue) {
|
|
13
14
|
if (bignumber_js_1.default.isBigNumber(bigNumber)) {
|
|
@@ -21,4 +22,12 @@ function isSendTransactionIntent(tx) {
|
|
|
21
22
|
function isStakingTransactionIntent(tx) {
|
|
22
23
|
return tx.intentType === 'staking';
|
|
23
24
|
}
|
|
25
|
+
function isHttpTooManyRequests(error) {
|
|
26
|
+
return (error instanceof Error &&
|
|
27
|
+
'response' in error &&
|
|
28
|
+
typeof error.response === 'object' &&
|
|
29
|
+
error.response !== null &&
|
|
30
|
+
'status' in error.response &&
|
|
31
|
+
error.response.status === 429);
|
|
32
|
+
}
|
|
24
33
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;;;AAUtC,sDAQC;AAED,0DAEC;AAED,gEAEC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;;;AAUtC,sDAQC;AAED,0DAEC;AAED,gEAEC;AAED,sDASC;AAlCD,gEAAoC;AAOpC,SAAgB,qBAAqB,CACnC,SAAgC,EAChC,YAAqB;IAErB,IAAI,sBAAS,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAA;IACpC,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,SAAgB,uBAAuB,CAAC,EAAqB;IAC3D,OAAO,EAAE,CAAC,UAAU,KAAK,aAAa,CAAA;AACxC,CAAC;AAED,SAAgB,0BAA0B,CAAC,EAAqB;IAC9D,OAAO,EAAE,CAAC,UAAU,KAAK,SAAS,CAAA;AACpC,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAc;IAClD,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,UAAU,IAAI,KAAK;QACnB,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAClC,KAAK,CAAC,QAAQ,KAAK,IAAI;QACvB,QAAQ,IAAI,KAAK,CAAC,QAAQ;QAC1B,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,CAC9B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertBlockHeight.d.ts","sourceRoot":"","sources":["../../../src/api/getBlock/assertBlockHeight.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAItD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { InvalidBlockHeightError } from '../../errors';
|
|
4
|
+
export function assertBlockHeight(height) {
|
|
5
|
+
if (!Number.isSafeInteger(height) || height <= 0) {
|
|
6
|
+
throw new InvalidBlockHeightError(`Invalid block height: ${height}`, { height });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=assertBlockHeight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertBlockHeight.js","sourceRoot":"","sources":["../../../src/api/getBlock/assertBlockHeight.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,uBAAuB,CAAC,yBAAyB,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;IAClF,CAAC;AACH,CAAC"}
|
package/lib-es/api/impl.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ import type { CoinModuleApi, Memo, MemoNotSupported, TxData, TxDataNotSupported
|
|
|
16
16
|
* validateAddress or addresses without a network round-trip)
|
|
17
17
|
* AccountInfo — getAccountInfo (chain-specific account metadata; absent means
|
|
18
18
|
* "nothing to report", not "unsupported")
|
|
19
|
+
* Holdings — listHoldings (the units an address's funds are made of; coin control)
|
|
19
20
|
*/
|
|
20
|
-
export declare const optionalApiKeys: readonly ["getBlock", "getBlockInfo", "getStakes", "getRewards", "getValidators", "call", "craftRawTransaction", "register", "getNextSequence", "validateIntent", "validateAddress", "getAccountInfo"];
|
|
21
|
+
export declare const optionalApiKeys: readonly ["getBlock", "getBlockInfo", "getStakes", "getRewards", "getValidators", "call", "craftRawTransaction", "register", "getNextSequence", "validateIntent", "validateAddress", "getAccountInfo", "listHoldings"];
|
|
21
22
|
/**
|
|
22
23
|
* A method name that a {@link CoinModuleImpl} author may omit.
|
|
23
24
|
*
|
|
@@ -40,7 +41,7 @@ export type RequiredApiKey = (typeof requiredApiKeys)[number];
|
|
|
40
41
|
* `listFeeOptions` is neither required nor omittable — the contract itself declares it
|
|
41
42
|
* optional and `withDefaults` does not backfill it — hence its place here and nowhere else.
|
|
42
43
|
*/
|
|
43
|
-
export declare const apiMethodKeys: readonly ["lastBlock", "getBalance", "listOperations", "craftTransaction", "estimateFees", "combine", "broadcast", "craftTransactionData", "getBlock", "getBlockInfo", "getStakes", "getRewards", "getValidators", "call", "craftRawTransaction", "register", "getNextSequence", "validateIntent", "validateAddress", "getAccountInfo", "listFeeOptions"];
|
|
44
|
+
export declare const apiMethodKeys: readonly ["lastBlock", "getBalance", "listOperations", "craftTransaction", "estimateFees", "combine", "broadcast", "craftTransactionData", "getBlock", "getBlockInfo", "getStakes", "getRewards", "getValidators", "call", "craftRawTransaction", "register", "getNextSequence", "validateIntent", "validateAddress", "getAccountInfo", "listHoldings", "listFeeOptions"];
|
|
44
45
|
/** A method name declared by the {@link CoinModuleApi} contract. */
|
|
45
46
|
export type ApiMethodKey = (typeof apiMethodKeys)[number];
|
|
46
47
|
/**
|
|
@@ -51,6 +52,21 @@ export type ApiMethodKey = (typeof apiMethodKeys)[number];
|
|
|
51
52
|
*/
|
|
52
53
|
type AssertNever<T extends never> = T;
|
|
53
54
|
export type ApiMethodKeysAreExhaustive = AssertNever<Exclude<keyof CoinModuleApi<CurrencyConfig>, ApiMethodKey>>;
|
|
55
|
+
/** An opt-in read option: a field of the method's options that changes what it returns. */
|
|
56
|
+
export type ReadOption = 'feesAsset';
|
|
57
|
+
/** A method that takes a {@link ReadOption}. */
|
|
58
|
+
export type ReadOptionMethod = 'listOperations' | 'getBlock';
|
|
59
|
+
/**
|
|
60
|
+
* The read options a module honours, per method.
|
|
61
|
+
*
|
|
62
|
+
* A read option changes the meaning of an existing output, and JavaScript ignores arguments a
|
|
63
|
+
* method does not read. A module must therefore declare each option it honours: `withDefaults`
|
|
64
|
+
* rejects an opted-in call to a method that does not declare it, instead of returning the
|
|
65
|
+
* legacy output.
|
|
66
|
+
*/
|
|
67
|
+
export type ReadOptionsDeclaration = {
|
|
68
|
+
readonly [M in ReadOptionMethod]?: readonly ReadOption[];
|
|
69
|
+
};
|
|
54
70
|
/**
|
|
55
71
|
* Authoring type for a coin-module implementation.
|
|
56
72
|
*
|
|
@@ -69,6 +85,9 @@ export type ApiMethodKeysAreExhaustive = AssertNever<Exclude<keyof CoinModuleApi
|
|
|
69
85
|
*
|
|
70
86
|
* @see CoinModuleApi — the full consumer/runtime contract (unchanged)
|
|
71
87
|
*/
|
|
72
|
-
export type CoinModuleImpl<ConfigType extends CurrencyConfig, MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = Omit<CoinModuleApi<ConfigType, MemoType, TxDataType>, OptionalApiKey> & Partial<Pick<CoinModuleApi<ConfigType, MemoType, TxDataType>, OptionalApiKey
|
|
88
|
+
export type CoinModuleImpl<ConfigType extends CurrencyConfig, MemoType extends Memo = MemoNotSupported, TxDataType extends TxData = TxDataNotSupported> = Omit<CoinModuleApi<ConfigType, MemoType, TxDataType>, OptionalApiKey> & Partial<Pick<CoinModuleApi<ConfigType, MemoType, TxDataType>, OptionalApiKey>> & {
|
|
89
|
+
/** The read options this module honours. See {@link ReadOptionsDeclaration}. */
|
|
90
|
+
readOptions?: ReadOptionsDeclaration;
|
|
91
|
+
};
|
|
73
92
|
export {};
|
|
74
93
|
//# sourceMappingURL=impl.d.ts.map
|
package/lib-es/api/impl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/api/impl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEhG
|
|
1
|
+
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/api/impl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEhG;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,wNAclB,CAAA;AAEV;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,eAAe,4IASlB,CAAA;AAEV,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,2WAAsE,CAAA;AAEhG,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,KAAK,WAAW,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,CAAA;AACrC,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAClD,OAAO,CAAC,MAAM,aAAa,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC,CAC3D,CAAA;AAED,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG,WAAW,CAAA;AAEpC,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,UAAU,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,CAAC,IAAI,gBAAgB,CAAC,CAAC,EAAE,SAAS,UAAU,EAAE;CACzD,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,CACxB,UAAU,SAAS,cAAc,EACjC,QAAQ,SAAS,IAAI,GAAG,gBAAgB,EACxC,UAAU,SAAS,MAAM,GAAG,kBAAkB,IAC5C,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,cAAc,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG;IAC/E,gFAAgF;IAChF,WAAW,CAAC,EAAE,sBAAsB,CAAA;CACrC,CAAA"}
|
package/lib-es/api/impl.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* validateAddress or addresses without a network round-trip)
|
|
17
17
|
* AccountInfo — getAccountInfo (chain-specific account metadata; absent means
|
|
18
18
|
* "nothing to report", not "unsupported")
|
|
19
|
+
* Holdings — listHoldings (the units an address's funds are made of; coin control)
|
|
19
20
|
*/
|
|
20
21
|
export const optionalApiKeys = [
|
|
21
22
|
'getBlock',
|
|
@@ -30,6 +31,7 @@ export const optionalApiKeys = [
|
|
|
30
31
|
'validateIntent',
|
|
31
32
|
'validateAddress',
|
|
32
33
|
'getAccountInfo',
|
|
34
|
+
'listHoldings',
|
|
33
35
|
];
|
|
34
36
|
/**
|
|
35
37
|
* Methods every {@link CoinModuleImpl} author must implement: the minimum a chain has to
|
package/lib-es/api/impl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.js","sourceRoot":"","sources":["../../src/api/impl.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAKtC
|
|
1
|
+
{"version":3,"file":"impl.js","sourceRoot":"","sources":["../../src/api/impl.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAKtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU;IACV,cAAc;IACd,WAAW;IACX,YAAY;IACZ,eAAe;IACf,MAAM;IACN,qBAAqB;IACrB,UAAU;IACV,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;CACN,CAAA;AAUV;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,SAAS;IACT,WAAW;IACX,sBAAsB;CACd,CAAA;AAKV;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,eAAe,EAAE,gBAAgB,CAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notSupportedApi.d.ts","sourceRoot":"","sources":["../../src/api/notSupportedApi.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAGhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAC7B,UAAU,SAAS,cAAc,EACjC,QAAQ,SAAS,IAAI,GAAG,gBAAgB,EACxC,UAAU,SAAS,MAAM,GAAG,kBAAkB,KAC3C,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"notSupportedApi.d.ts","sourceRoot":"","sources":["../../src/api/notSupportedApi.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAGhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAC7B,UAAU,SAAS,cAAc,EACjC,QAAQ,SAAS,IAAI,GAAG,gBAAgB,EACxC,UAAU,SAAS,MAAM,GAAG,kBAAkB,KAC3C,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CA8BnD"}
|
|
@@ -58,6 +58,7 @@ export function notSupportedApi() {
|
|
|
58
58
|
getNextSequence: notSupported('getNextSequence'),
|
|
59
59
|
validateIntent: notSupported('validateIntent'),
|
|
60
60
|
validateAddress: notSupported('validateAddress'),
|
|
61
|
+
listHoldings: notSupported('listHoldings'),
|
|
61
62
|
// Not a capability: absent metadata is an answer (ADR-045).
|
|
62
63
|
getAccountInfo: () => Promise.resolve({ type: 'none' }),
|
|
63
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notSupportedApi.js","sourceRoot":"","sources":["../../src/api/notSupportedApi.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAItC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;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E,YAAY,CAAC,WAAW,CAAC;QACpC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC;QACtC,cAAc,EAAE,YAAY,CAAC,gBAAgB,CAAC;QAC9C,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,CAAC;QAClD,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC;QAC1C,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC;QAChC,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC;QACpC,oBAAoB,EAAE,YAAY,CAAC,sBAAsB,CAAC;QAE1D,yBAAyB;QACzB,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC;QAClC,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC;QAC1C,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC;QACpC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC;QACtC,aAAa,EAAE,YAAY,CAAC,eAAe,CAAC;QAC5C,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC;QAC1B,mBAAmB,EAAE,YAAY,CAAC,qBAAqB,CAAC;QACxD,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC;QAClC,eAAe,EAAE,YAAY,CAAC,iBAAiB,CAAC;QAChD,cAAc,EAAE,YAAY,CAAC,gBAAgB,CAAC;QAC9C,eAAe,EAAE,YAAY,CAAC,iBAAiB,CAAC;QAChD,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC;QAE1C,4DAA4D;QAC5D,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KACxD,CAAA;AACH,CAAC"}
|
package/lib-es/api/types.d.ts
CHANGED
|
@@ -57,10 +57,31 @@ export type Operation<MemoType extends Memo = MemoNotSupported> = {
|
|
|
57
57
|
* This can include things like status, error messages, swap info, etc.
|
|
58
58
|
*/
|
|
59
59
|
details?: Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* The transaction this operation belongs to.
|
|
62
|
+
*
|
|
63
|
+
* When the caller sets {@link ListOperationsOptions.feesAsset}, these rules apply:
|
|
64
|
+
*
|
|
65
|
+
* 1. When {@link tx.feesAsset} is absent, the fee is in the native coin.
|
|
66
|
+
* 2. A consumer debits {@link tx.fees} once, in {@link tx.feesAsset}, from {@link tx.feesPayer}. A failed transaction
|
|
67
|
+
* also pays.
|
|
68
|
+
* 3. Operations never include the fee movement, in any asset. When a chain emits the fee as token transfers, the
|
|
69
|
+
* module removes them.
|
|
70
|
+
* 4. When the fee is the only effect of a transaction on the account, the account gets one operation with
|
|
71
|
+
* {@link Operation.value} 0 that carries {@link tx.fees}, {@link tx.feesAsset} and {@link tx.feesPayer}.
|
|
72
|
+
* 5. {@link tx.fees} is the amount the chain debited, never a value converted from another unit.
|
|
73
|
+
*/
|
|
60
74
|
tx: {
|
|
61
75
|
hash: string;
|
|
62
76
|
block: BlockInfo;
|
|
77
|
+
/** The network fees paid, in base units of {@link feesAsset}, or of the native coin when it is absent. */
|
|
63
78
|
fees: bigint;
|
|
79
|
+
/**
|
|
80
|
+
* The asset that paid {@link fees}. Absent means the native coin.
|
|
81
|
+
*
|
|
82
|
+
* Set only when the caller sets {@link ListOperationsOptions.feesAsset}.
|
|
83
|
+
*/
|
|
84
|
+
feesAsset?: AssetInfo;
|
|
64
85
|
feesPayer?: string;
|
|
65
86
|
date: Date;
|
|
66
87
|
/**
|
|
@@ -95,6 +116,17 @@ export type Block = {
|
|
|
95
116
|
};
|
|
96
117
|
/**
|
|
97
118
|
* A transaction belonging to a {@link Block}, not specific to a particular account/address.
|
|
119
|
+
*
|
|
120
|
+
* When the caller sets {@link GetBlockOptions.feesAsset}, these rules apply:
|
|
121
|
+
*
|
|
122
|
+
* 1. When {@link feesAsset} is absent, the fee is in the native coin.
|
|
123
|
+
* 2. A consumer debits {@link fees} once, in {@link feesAsset}, from {@link feesPayer}. A failed transaction also
|
|
124
|
+
* pays.
|
|
125
|
+
* 3. {@link operations} never include the fee movement, in any asset. When a chain emits the fee as token transfers,
|
|
126
|
+
* the module removes them.
|
|
127
|
+
* 4. A transaction whose only effect is its fee is still included, with its fee fields. Its {@link operations} can be
|
|
128
|
+
* empty.
|
|
129
|
+
* 5. {@link fees} is the amount the chain debited, never a value converted from another unit.
|
|
98
130
|
*/
|
|
99
131
|
export type BlockTransaction = {
|
|
100
132
|
/** The transaction hash/digest (globally unique identifier). */
|
|
@@ -117,8 +149,17 @@ export type BlockTransaction = {
|
|
|
117
149
|
operations: BlockOperation[];
|
|
118
150
|
/** Network specific details for this transaction. */
|
|
119
151
|
details?: Record<string, unknown>;
|
|
120
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* The fee amount paid for this transaction, in base units of {@link feesAsset}, or of the native coin when it is
|
|
154
|
+
* absent. Always positive or zero.
|
|
155
|
+
*/
|
|
121
156
|
fees: bigint;
|
|
157
|
+
/**
|
|
158
|
+
* The asset that paid {@link fees}. Absent means the native coin.
|
|
159
|
+
*
|
|
160
|
+
* Set only when the caller sets {@link GetBlockOptions.feesAsset}.
|
|
161
|
+
*/
|
|
162
|
+
feesAsset?: AssetInfo;
|
|
122
163
|
/** The address that paid for this transaction's fees. */
|
|
123
164
|
feesPayer?: string;
|
|
124
165
|
};
|
|
@@ -373,6 +414,42 @@ export type Page<T> = {
|
|
|
373
414
|
/** Falsy means the stream is exhausted; truthy means more may exist, and must advance. */
|
|
374
415
|
next?: Cursor | undefined;
|
|
375
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* A unit of an address's funds: what a transaction spends, and what coin control selects.
|
|
419
|
+
*
|
|
420
|
+
* On UTXO, object and record chains it is one spendable unit (an unspent output, a coin object,
|
|
421
|
+
* a record); on account chains it is one balance per asset. A unit that carries several assets
|
|
422
|
+
* (a Cardano output with native tokens) is listed once per asset, the entries sharing its `id`:
|
|
423
|
+
* selecting or excluding that `id` takes the whole unit, all its assets.
|
|
424
|
+
*/
|
|
425
|
+
export type Holding = {
|
|
426
|
+
/**
|
|
427
|
+
* How a transaction intent refers to this holding. Opaque to the framework: its format belongs
|
|
428
|
+
* to the chain ("txid:vout", an object id, a record commitment, an account address…), and a
|
|
429
|
+
* caller only sends it back unchanged.
|
|
430
|
+
*/
|
|
431
|
+
id: string;
|
|
432
|
+
/** The asset this holding is denominated in. */
|
|
433
|
+
asset: AssetInfo;
|
|
434
|
+
/** The amount, in the asset's base unit. */
|
|
435
|
+
value: bigint;
|
|
436
|
+
/** Block height the holding was created at; `null` while unconfirmed, absent if unknown. */
|
|
437
|
+
height?: number | null;
|
|
438
|
+
/**
|
|
439
|
+
* The non-spendable part of {@link value}, as {@link Balance} `locked` (eg: a reserve, a frozen,
|
|
440
|
+
* staked, immature or time-locked amount).
|
|
441
|
+
*/
|
|
442
|
+
locked?: bigint;
|
|
443
|
+
/** Chain-specific fields (script, record ciphertext…). */
|
|
444
|
+
details?: Record<string, unknown>;
|
|
445
|
+
};
|
|
446
|
+
/** Options for {@link CoinModuleApi#listHoldings}. */
|
|
447
|
+
export type ListHoldingsOptions = {
|
|
448
|
+
/** Only the holdings of this asset. Omitted: every asset. */
|
|
449
|
+
asset?: AssetInfo;
|
|
450
|
+
/** A cursor from a previous page's `next`, to resume listing. */
|
|
451
|
+
cursor?: Cursor;
|
|
452
|
+
};
|
|
376
453
|
/** Options for {@link CoinModuleApi#listOperations}. */
|
|
377
454
|
export type ListOperationsOptions = {
|
|
378
455
|
/**
|
|
@@ -401,6 +478,24 @@ export type ListOperationsOptions = {
|
|
|
401
478
|
* Implementation must raise a "not supported" error if order is set and not supported.
|
|
402
479
|
*/
|
|
403
480
|
order?: 'asc' | 'desc';
|
|
481
|
+
/**
|
|
482
|
+
* Report the asset that paid each fee, as `feesAsset` in {@link Operation.tx}, under the rules stated there.
|
|
483
|
+
*
|
|
484
|
+
* When it is not set, the output is the legacy one: `fees` is read as native. A module that honours this option
|
|
485
|
+
* declares it in `CoinModuleImpl.readOptions`; otherwise `withDefaults` rejects the call.
|
|
486
|
+
*/
|
|
487
|
+
feesAsset?: boolean;
|
|
488
|
+
};
|
|
489
|
+
/** Options for {@link CoinModuleApi#getBlock}. */
|
|
490
|
+
export type GetBlockOptions = {
|
|
491
|
+
/**
|
|
492
|
+
* Report the asset that paid each fee in {@link BlockTransaction.feesAsset}, under the rules on
|
|
493
|
+
* {@link BlockTransaction}.
|
|
494
|
+
*
|
|
495
|
+
* When it is not set, the output is the legacy one: `fees` is read as native. A module that honours this option
|
|
496
|
+
* declares it in `CoinModuleImpl.readOptions`; otherwise `withDefaults` rejects the call.
|
|
497
|
+
*/
|
|
498
|
+
feesAsset?: boolean;
|
|
404
499
|
};
|
|
405
500
|
/** A network validator */
|
|
406
501
|
export type Validator = {
|
|
@@ -469,6 +564,23 @@ export type BalanceOptions = {
|
|
|
469
564
|
* `knownAssets` is empty.
|
|
470
565
|
*/
|
|
471
566
|
scanAssetsMinHeight?: number;
|
|
567
|
+
/**
|
|
568
|
+
* Validators the caller knows for this account (the validators of the positions it stored),
|
|
569
|
+
* read unconditionally on top of those the delegation listing returns.
|
|
570
|
+
*
|
|
571
|
+
* Nothing is stored module-side: the caller keeps this list and passes it back on every call.
|
|
572
|
+
* When the listing fails, positions are returned for these validators alone, none when the list
|
|
573
|
+
* is empty. Absent means the caller knows nothing: a listing failure fails the call.
|
|
574
|
+
*/
|
|
575
|
+
knownValidatorIds?: string[] | undefined;
|
|
576
|
+
/**
|
|
577
|
+
* Whether to call the delegation listing. Absent means `true`.
|
|
578
|
+
*
|
|
579
|
+
* `false` returns positions for {@link knownValidatorIds} alone, without calling the listing.
|
|
580
|
+
* A caller passes it only when it knows no position can have been added since its list was
|
|
581
|
+
* built. Ignored when {@link knownValidatorIds} is absent.
|
|
582
|
+
*/
|
|
583
|
+
listValidators?: boolean | undefined;
|
|
472
584
|
};
|
|
473
585
|
export type StakesOptions = {
|
|
474
586
|
/**
|
|
@@ -524,10 +636,11 @@ export type CoinModuleApi<ConfigType extends CurrencyConfig, MemoType extends Me
|
|
|
524
636
|
*
|
|
525
637
|
* @param context the {@link Context} carrying the coin config accessor and logger
|
|
526
638
|
* @param height the block height to query
|
|
639
|
+
* @param options see {@link GetBlockOptions}
|
|
527
640
|
* @returns the complete block with transactions
|
|
528
641
|
* @throws "not supported" if the blockchain does not support querying full blocks
|
|
529
642
|
*/
|
|
530
|
-
getBlock: (context: Context<ConfigType>, height: number) => Promise<Block>;
|
|
643
|
+
getBlock: (context: Context<ConfigType>, height: number, options?: GetBlockOptions) => Promise<Block>;
|
|
531
644
|
/**
|
|
532
645
|
* Perform a direct, read-only smart-contract call against the underlying node or indexer.
|
|
533
646
|
*
|
|
@@ -650,6 +763,21 @@ export type CoinModuleApi<ConfigType extends CurrencyConfig, MemoType extends Me
|
|
|
650
763
|
* @see getBalance
|
|
651
764
|
*/
|
|
652
765
|
getAccountInfo?: (context: Context<ConfigType>, address: string) => Promise<AccountInfo>;
|
|
766
|
+
/**
|
|
767
|
+
* List the units an address's funds are made of: the spendable units a transaction consumes
|
|
768
|
+
* on UTXO, object and record chains, one holding per asset on account chains.
|
|
769
|
+
*
|
|
770
|
+
* Paginated: the response follows the {@link Page} contract.
|
|
771
|
+
*
|
|
772
|
+
* Implementations without a notion of holdings must raise a "not supported" error.
|
|
773
|
+
*
|
|
774
|
+
* @param context the {@link Context} carrying the coin config accessor and logger
|
|
775
|
+
* @param address the account address
|
|
776
|
+
* @param options asset filter and pagination cursor (see {@link ListHoldingsOptions})
|
|
777
|
+
* @returns a page of {@link Holding}
|
|
778
|
+
* @see getBalance
|
|
779
|
+
*/
|
|
780
|
+
listHoldings: (context: Context<ConfigType>, address: string, options?: ListHoldingsOptions) => Promise<Page<Holding>>;
|
|
653
781
|
/**
|
|
654
782
|
* Register an account with the indexing backend selected by the context.
|
|
655
783
|
*
|