@gala-chain/gswap-sdk 2.1.0-beta.0 → 2.1.0-beta.2
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/README.md +6 -0
- package/dist/browser/classes/gswap_error_catalog.js +1 -1
- package/dist/browser/classes/gswap_error_catalog.js.map +1 -1
- package/dist/browser/classes/gswap_error_phase_table.js +1 -1
- package/dist/browser/classes/gswap_error_phase_table.js.map +1 -1
- package/dist/browser/classes/gswap_sdk_error.js +1 -1
- package/dist/browser/classes/gswap_sdk_error.js.map +1 -1
- package/dist/browser/utils/failure_classification.js +1 -1
- package/dist/browser/utils/failure_classification.js.map +1 -1
- package/dist/browser/utils/failure_guards.js +1 -1
- package/dist/browser/utils/failure_guards.js.map +1 -1
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -368,6 +368,13 @@ export declare const GSWAP_ERROR_CATALOG: {
|
|
|
368
368
|
readonly serverMessage: 'string';
|
|
369
369
|
};
|
|
370
370
|
};
|
|
371
|
+
readonly DTO_OPERATION_MISMATCH: {
|
|
372
|
+
readonly phase: 'post_send';
|
|
373
|
+
readonly template: 'The signed DTO has no dtoOperation, or one that is not the call it was sent to: {serverMessage}';
|
|
374
|
+
readonly params: {
|
|
375
|
+
readonly serverMessage: 'string';
|
|
376
|
+
};
|
|
377
|
+
};
|
|
371
378
|
readonly BOUNDS_VIOLATION: {
|
|
372
379
|
readonly phase: 'post_send';
|
|
373
380
|
readonly template: 'The gateway rejected a numeric, tick, symbol or range bound: {serverMessage}';
|
|
@@ -3472,6 +3479,7 @@ export declare const GSWAP_ERROR_PHASE_BY_CODE: {
|
|
|
3472
3479
|
readonly SIGNATURE_INVALID: 'post_send';
|
|
3473
3480
|
readonly SIGNER_MISMATCH: 'post_send';
|
|
3474
3481
|
readonly DTO_INVALID: 'post_send';
|
|
3482
|
+
readonly DTO_OPERATION_MISMATCH: 'post_send';
|
|
3475
3483
|
readonly BOUNDS_VIOLATION: 'post_send';
|
|
3476
3484
|
readonly SYMBOL_CONFLICT: 'post_send';
|
|
3477
3485
|
readonly RATE_LIMITED: 'post_send';
|
|
@@ -4142,8 +4150,8 @@ export declare function isUnprovenAcknowledgement(error: unknown): boolean;
|
|
|
4142
4150
|
/**
|
|
4143
4151
|
* True when the error is a gateway refusal whose `params.serverMessage` an app may relay to the
|
|
4144
4152
|
* person as the gateway sent it: `GATEWAY_REPORTED_ERROR`, the gateway bounces (`METHOD_NOT_ALLOWED`,
|
|
4145
|
-
* `SIGNATURE_INVALID`, `SIGNER_MISMATCH`, `DTO_INVALID`, `
|
|
4146
|
-
* `RATE_LIMITED`, `GATEWAY_REJECTED`) and `CHAIN_DISPATCH_FAILED`. The app shows `serverMessage` when
|
|
4153
|
+
* `SIGNATURE_INVALID`, `SIGNER_MISMATCH`, `DTO_INVALID`, `DTO_OPERATION_MISMATCH`, `BOUNDS_VIOLATION`,
|
|
4154
|
+
* `SYMBOL_CONFLICT`, `RATE_LIMITED`, `GATEWAY_REJECTED`) and `CHAIN_DISPATCH_FAILED`. The app shows `serverMessage` when
|
|
4147
4155
|
* it is not empty and its own line when it is; the SDK's English `message` is never what to show.
|
|
4148
4156
|
*
|
|
4149
4157
|
* It accepts a plain-object view of an SDK error too ({@link FailureView}: an app's wrapper with a
|
|
@@ -4167,7 +4175,7 @@ export declare function isUnprovenAcknowledgement(error: unknown): boolean;
|
|
|
4167
4175
|
export declare function isRelayableRefusal(error: GSwapSDKError): error is GSwapSDKError<RelayableCode>;
|
|
4168
4176
|
export declare function isRelayableRefusal(error: unknown): boolean;
|
|
4169
4177
|
/** The codes {@link isRelayableRefusal} is true for. */
|
|
4170
|
-
export type RelayableCode = 'GATEWAY_REPORTED_ERROR' | 'METHOD_NOT_ALLOWED' | 'SIGNATURE_INVALID' | 'SIGNER_MISMATCH' | 'DTO_INVALID' | 'BOUNDS_VIOLATION' | 'SYMBOL_CONFLICT' | 'RATE_LIMITED' | 'CHAIN_DISPATCH_FAILED' | 'GATEWAY_REJECTED';
|
|
4178
|
+
export type RelayableCode = 'GATEWAY_REPORTED_ERROR' | 'METHOD_NOT_ALLOWED' | 'SIGNATURE_INVALID' | 'SIGNER_MISMATCH' | 'DTO_INVALID' | 'DTO_OPERATION_MISMATCH' | 'BOUNDS_VIOLATION' | 'SYMBOL_CONFLICT' | 'RATE_LIMITED' | 'CHAIN_DISPATCH_FAILED' | 'GATEWAY_REJECTED';
|
|
4171
4179
|
/**
|
|
4172
4180
|
* True when a write got a 2xx answer the SDK refused to interpret, so the answer itself is in
|
|
4173
4181
|
* `error.body` (or `error.bodyText`) for the app to read: the five unproven acknowledgements
|
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,13 @@ export declare const GSWAP_ERROR_CATALOG: {
|
|
|
368
368
|
readonly serverMessage: 'string';
|
|
369
369
|
};
|
|
370
370
|
};
|
|
371
|
+
readonly DTO_OPERATION_MISMATCH: {
|
|
372
|
+
readonly phase: 'post_send';
|
|
373
|
+
readonly template: 'The signed DTO has no dtoOperation, or one that is not the call it was sent to: {serverMessage}';
|
|
374
|
+
readonly params: {
|
|
375
|
+
readonly serverMessage: 'string';
|
|
376
|
+
};
|
|
377
|
+
};
|
|
371
378
|
readonly BOUNDS_VIOLATION: {
|
|
372
379
|
readonly phase: 'post_send';
|
|
373
380
|
readonly template: 'The gateway rejected a numeric, tick, symbol or range bound: {serverMessage}';
|
|
@@ -3472,6 +3479,7 @@ export declare const GSWAP_ERROR_PHASE_BY_CODE: {
|
|
|
3472
3479
|
readonly SIGNATURE_INVALID: 'post_send';
|
|
3473
3480
|
readonly SIGNER_MISMATCH: 'post_send';
|
|
3474
3481
|
readonly DTO_INVALID: 'post_send';
|
|
3482
|
+
readonly DTO_OPERATION_MISMATCH: 'post_send';
|
|
3475
3483
|
readonly BOUNDS_VIOLATION: 'post_send';
|
|
3476
3484
|
readonly SYMBOL_CONFLICT: 'post_send';
|
|
3477
3485
|
readonly RATE_LIMITED: 'post_send';
|
|
@@ -4142,8 +4150,8 @@ export declare function isUnprovenAcknowledgement(error: unknown): boolean;
|
|
|
4142
4150
|
/**
|
|
4143
4151
|
* True when the error is a gateway refusal whose `params.serverMessage` an app may relay to the
|
|
4144
4152
|
* person as the gateway sent it: `GATEWAY_REPORTED_ERROR`, the gateway bounces (`METHOD_NOT_ALLOWED`,
|
|
4145
|
-
* `SIGNATURE_INVALID`, `SIGNER_MISMATCH`, `DTO_INVALID`, `
|
|
4146
|
-
* `RATE_LIMITED`, `GATEWAY_REJECTED`) and `CHAIN_DISPATCH_FAILED`. The app shows `serverMessage` when
|
|
4153
|
+
* `SIGNATURE_INVALID`, `SIGNER_MISMATCH`, `DTO_INVALID`, `DTO_OPERATION_MISMATCH`, `BOUNDS_VIOLATION`,
|
|
4154
|
+
* `SYMBOL_CONFLICT`, `RATE_LIMITED`, `GATEWAY_REJECTED`) and `CHAIN_DISPATCH_FAILED`. The app shows `serverMessage` when
|
|
4147
4155
|
* it is not empty and its own line when it is; the SDK's English `message` is never what to show.
|
|
4148
4156
|
*
|
|
4149
4157
|
* It accepts a plain-object view of an SDK error too ({@link FailureView}: an app's wrapper with a
|
|
@@ -4167,7 +4175,7 @@ export declare function isUnprovenAcknowledgement(error: unknown): boolean;
|
|
|
4167
4175
|
export declare function isRelayableRefusal(error: GSwapSDKError): error is GSwapSDKError<RelayableCode>;
|
|
4168
4176
|
export declare function isRelayableRefusal(error: unknown): boolean;
|
|
4169
4177
|
/** The codes {@link isRelayableRefusal} is true for. */
|
|
4170
|
-
export type RelayableCode = 'GATEWAY_REPORTED_ERROR' | 'METHOD_NOT_ALLOWED' | 'SIGNATURE_INVALID' | 'SIGNER_MISMATCH' | 'DTO_INVALID' | 'BOUNDS_VIOLATION' | 'SYMBOL_CONFLICT' | 'RATE_LIMITED' | 'CHAIN_DISPATCH_FAILED' | 'GATEWAY_REJECTED';
|
|
4178
|
+
export type RelayableCode = 'GATEWAY_REPORTED_ERROR' | 'METHOD_NOT_ALLOWED' | 'SIGNATURE_INVALID' | 'SIGNER_MISMATCH' | 'DTO_INVALID' | 'DTO_OPERATION_MISMATCH' | 'BOUNDS_VIOLATION' | 'SYMBOL_CONFLICT' | 'RATE_LIMITED' | 'CHAIN_DISPATCH_FAILED' | 'GATEWAY_REJECTED';
|
|
4171
4179
|
/**
|
|
4172
4180
|
* True when a write got a 2xx answer the SDK refused to interpret, so the answer itself is in
|
|
4173
4181
|
* `error.body` (or `error.bodyText`) for the app to read: the five unproven acknowledgements
|
package/dist/index.mjs
CHANGED
|
@@ -222,6 +222,11 @@ const GSWAP_ERROR_CATALOG = {
|
|
|
222
222
|
template: "The gateway rejected the DTO shape: {serverMessage}",
|
|
223
223
|
params: { serverMessage: "string" }
|
|
224
224
|
},
|
|
225
|
+
DTO_OPERATION_MISMATCH: {
|
|
226
|
+
phase: "post_send",
|
|
227
|
+
template: "The signed DTO has no dtoOperation, or one that is not the call it was sent to: {serverMessage}",
|
|
228
|
+
params: { serverMessage: "string" }
|
|
229
|
+
},
|
|
225
230
|
BOUNDS_VIOLATION: {
|
|
226
231
|
phase: "post_send",
|
|
227
232
|
template: "The gateway rejected a numeric, tick, symbol or range bound: {serverMessage}",
|
|
@@ -731,6 +736,7 @@ const GSWAP_ERROR_PHASE_BY_CODE = {
|
|
|
731
736
|
SIGNATURE_INVALID: "post_send",
|
|
732
737
|
SIGNER_MISMATCH: "post_send",
|
|
733
738
|
DTO_INVALID: "post_send",
|
|
739
|
+
DTO_OPERATION_MISMATCH: "post_send",
|
|
734
740
|
BOUNDS_VIOLATION: "post_send",
|
|
735
741
|
SYMBOL_CONFLICT: "post_send",
|
|
736
742
|
RATE_LIMITED: "post_send",
|
|
@@ -906,6 +912,7 @@ var GSwapSDKError = class GSwapSDKError extends GalaSDKError {
|
|
|
906
912
|
case "SIGNATURE_INVALID": return new GSwapSDKError("SIGNATURE_INVALID", params, context);
|
|
907
913
|
case "SIGNER_MISMATCH": return new GSwapSDKError("SIGNER_MISMATCH", params, context);
|
|
908
914
|
case "DTO_INVALID": return new GSwapSDKError("DTO_INVALID", params, context);
|
|
915
|
+
case "DTO_OPERATION_MISMATCH": return new GSwapSDKError("DTO_OPERATION_MISMATCH", params, context);
|
|
909
916
|
case "BOUNDS_VIOLATION": return new GSwapSDKError("BOUNDS_VIOLATION", params, context);
|
|
910
917
|
case "SYMBOL_CONFLICT": return new GSwapSDKError("SYMBOL_CONFLICT", params, context);
|
|
911
918
|
case "RATE_LIMITED": return new GSwapSDKError("RATE_LIMITED", params, context);
|
|
@@ -5876,7 +5883,8 @@ const BY_CODE = {
|
|
|
5876
5883
|
METHOD_NOT_ALLOWED: NOT_QUEUED,
|
|
5877
5884
|
SIGNATURE_INVALID: NOT_QUEUED,
|
|
5878
5885
|
SIGNER_MISMATCH: NOT_QUEUED,
|
|
5879
|
-
DTO_INVALID:
|
|
5886
|
+
DTO_INVALID: NOT_QUEUED_FINAL,
|
|
5887
|
+
DTO_OPERATION_MISMATCH: NOT_QUEUED_FINAL,
|
|
5880
5888
|
BOUNDS_VIOLATION: NOT_QUEUED,
|
|
5881
5889
|
SYMBOL_CONFLICT: NOT_QUEUED,
|
|
5882
5890
|
RATE_LIMITED: NOT_QUEUED,
|
|
@@ -6545,6 +6553,7 @@ const RELAYABLE_REFUSAL_CODES = [
|
|
|
6545
6553
|
"SIGNATURE_INVALID",
|
|
6546
6554
|
"SIGNER_MISMATCH",
|
|
6547
6555
|
"DTO_INVALID",
|
|
6556
|
+
"DTO_OPERATION_MISMATCH",
|
|
6548
6557
|
"BOUNDS_VIOLATION",
|
|
6549
6558
|
"SYMBOL_CONFLICT",
|
|
6550
6559
|
"RATE_LIMITED",
|