@keetanetwork/anchor 0.0.45 → 0.0.47
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/LICENSE +163 -34
- package/lib/asset.d.ts +30 -0
- package/lib/asset.d.ts.map +1 -0
- package/lib/asset.js +78 -0
- package/lib/asset.js.map +1 -0
- package/lib/certificates.d.ts +15 -44
- package/lib/certificates.d.ts.map +1 -1
- package/lib/certificates.js +32 -342
- package/lib/certificates.js.map +1 -1
- package/lib/resolver.d.ts +9 -2
- package/lib/resolver.d.ts.map +1 -1
- package/lib/resolver.js +195 -159
- package/lib/resolver.js.map +1 -1
- package/lib/sensitive-attribute.d.ts +87 -0
- package/lib/sensitive-attribute.d.ts.map +1 -0
- package/lib/sensitive-attribute.js +419 -0
- package/lib/sensitive-attribute.js.map +1 -0
- package/lib/token-metadata.d.ts +21 -0
- package/lib/token-metadata.d.ts.map +1 -0
- package/lib/token-metadata.generated.d.ts +5 -0
- package/lib/token-metadata.generated.d.ts.map +1 -0
- package/lib/token-metadata.generated.js +70 -0
- package/lib/token-metadata.generated.js.map +1 -0
- package/lib/token-metadata.js +57 -0
- package/lib/token-metadata.js.map +1 -0
- package/lib/utils/pii.d.ts +128 -0
- package/lib/utils/pii.d.ts.map +1 -0
- package/lib/utils/pii.js +198 -0
- package/lib/utils/pii.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/services/asset-movement/common.d.ts +6 -28
- package/services/asset-movement/common.d.ts.map +1 -1
- package/services/asset-movement/common.js +3286 -2142
- package/services/asset-movement/common.js.map +1 -1
- package/services/asset-movement/lib/data/addresses/bank-account/interac.js +1 -1
- package/services/asset-movement/lib/data/addresses/bank-account/interac.js.map +1 -1
- package/services/asset-movement/lib/data/addresses/types.generated.d.ts +39 -31
- package/services/asset-movement/lib/data/addresses/types.generated.d.ts.map +1 -1
- package/services/asset-movement/lib/data/addresses/types.generated.js +37 -24
- package/services/asset-movement/lib/data/addresses/types.generated.js.map +1 -1
- package/services/asset-movement/lib/data/types.d.ts.map +1 -1
- package/services/asset-movement/lib/data/types.js +15 -10
- package/services/asset-movement/lib/data/types.js.map +1 -1
- package/services/fx/client.d.ts.map +1 -1
- package/services/fx/client.js +6 -2
- package/services/fx/client.js.map +1 -1
- package/services/fx/common.d.ts +14 -6
- package/services/fx/common.d.ts.map +1 -1
- package/services/fx/common.js +34 -8
- package/services/fx/common.js.map +1 -1
- package/services/fx/server.d.ts +6 -0
- package/services/fx/server.d.ts.map +1 -1
- package/services/fx/server.js +52 -10
- package/services/fx/server.js.map +1 -1
- package/services/kyc/common.d.ts +7 -0
- package/services/kyc/common.d.ts.map +1 -1
- package/services/kyc/common.generated.js +6 -1
- package/services/kyc/common.generated.js.map +1 -1
- package/services/kyc/common.js.map +1 -1
- package/services/notification/client.d.ts +1 -1
- package/services/notification/client.d.ts.map +1 -1
- package/services/notification/client.js +65 -2
- package/services/notification/client.js.map +1 -1
- package/services/notification/common.d.ts +1 -0
- package/services/notification/common.d.ts.map +1 -1
- package/services/notification/common.js.map +1 -1
- package/services/storage/clients/contacts.generated.js +370 -227
- package/services/storage/clients/contacts.generated.js.map +1 -1
- package/services/storage/server.d.ts +8 -1
- package/services/storage/server.d.ts.map +1 -1
- package/services/storage/server.js +9 -1
- package/services/storage/server.js.map +1 -1
package/services/fx/common.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
|
|
2
|
+
import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
|
|
2
3
|
import { createAssert, createIs } from 'typia';
|
|
3
4
|
import { KeetaAnchorUserError } from '../../lib/error.js';
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Parses a cost token from its serialized public key string form,
|
|
7
|
+
* reconstituting a KeetaNetToken instance.
|
|
8
|
+
*/
|
|
9
|
+
export function parseFXCostToken(input) {
|
|
10
|
+
if (KeetaNetLib.Account.isInstance(input)) {
|
|
11
|
+
return (input);
|
|
12
|
+
}
|
|
13
|
+
return (KeetaNetLib.Account.fromPublicKeyString(input).assertKeyType(KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN));
|
|
14
|
+
}
|
|
15
|
+
export const isKeetaFXAnchorEstimateResponse = (() => { const _io0 = input => true === input.ok && ("object" === typeof input.estimate && null !== input.estimate && _iu0(input.estimate)); const _io1 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && "string" === typeof input.convertedAmount && (undefined === input.convertedAmountBound || "string" === typeof input.convertedAmountBound) && ("object" === typeof input.expectedCost && null !== input.expectedCost && _io3(input.expectedCost)) && false === input.canPerformExchange; const _io2 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _io3 = input => "string" === typeof input.min && "string" === typeof input.max && ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token))); const _io4 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && "string" === typeof input.convertedAmount && (undefined === input.convertedAmountBound || "string" === typeof input.convertedAmountBound) && ("object" === typeof input.expectedCost && null !== input.expectedCost && _io3(input.expectedCost)) && (undefined === input.canPerformExchange || true === input.canPerformExchange) && false === input.requiresQuote && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))); const _io5 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && "string" === typeof input.convertedAmount && (undefined === input.convertedAmountBound || "string" === typeof input.convertedAmountBound) && ("object" === typeof input.expectedCost && null !== input.expectedCost && _io3(input.expectedCost)) && (undefined === input.canPerformExchange || true === input.canPerformExchange) && (undefined === input.requiresQuote || true === input.requiresQuote); const _io6 = input => false === input.ok && "string" === typeof input.error; const _iu0 = input => (() => {
|
|
5
16
|
if (false === input.canPerformExchange)
|
|
6
17
|
return _io1(input);
|
|
7
18
|
else if (false === input.requiresQuote)
|
|
@@ -16,7 +27,7 @@ export const isKeetaFXAnchorEstimateResponse = (() => { const _io0 = input => tr
|
|
|
16
27
|
else
|
|
17
28
|
return false;
|
|
18
29
|
})(); return input => "object" === typeof input && null !== input && _iu1(input); })();
|
|
19
|
-
export const isKeetaFXAnchorQuoteResponse = (() => { const _io0 = input => true === input.ok && ("object" === typeof input.quote && null !== input.quote && _io1(input.quote)); const _io1 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))) && "string" === typeof input.convertedAmount && ("object" === typeof input.cost && null !== input.cost && _io3(input.cost)) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io2 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity); const _io3 = input => "string" === typeof input.amount && ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token))); const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _io5 = input => false === input.ok && "string" === typeof input.error; const _iu0 = input => (() => {
|
|
30
|
+
export const isKeetaFXAnchorQuoteResponse = (() => { const _io0 = input => true === input.ok && ("object" === typeof input.quote && null !== input.quote && _io1(input.quote)); const _io1 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))) && "string" === typeof input.convertedAmount && ("object" === typeof input.cost && null !== input.cost && _io3(input.cost)) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io2 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _io3 = input => "string" === typeof input.amount && ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token))); const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _io5 = input => false === input.ok && "string" === typeof input.error; const _iu0 = input => (() => {
|
|
20
31
|
if (true === input.ok)
|
|
21
32
|
return _io0(input);
|
|
22
33
|
else if (false === input.ok)
|
|
@@ -24,7 +35,7 @@ export const isKeetaFXAnchorQuoteResponse = (() => { const _io0 = input => true
|
|
|
24
35
|
else
|
|
25
36
|
return false;
|
|
26
37
|
})(); return input => "object" === typeof input && null !== input && _iu0(input); })();
|
|
27
|
-
export const isKeetaFXAnchorExchangeResponse = (() => { const _io0 = input => "string" === typeof input.exchangeID && ("
|
|
38
|
+
export const isKeetaFXAnchorExchangeResponse = (() => { const _io0 = input => "string" === typeof input.exchangeID && ("failed" === input.status || "pending" === input.status) && true === input.ok; const _io1 = input => "string" === typeof input.exchangeID && "completed" === input.status && "string" === typeof input.blockhash && true === input.ok; const _io2 = input => (undefined === input.exchangeID || "string" === typeof input.exchangeID) && (undefined === input.status || "failed" === input.status || "pending" === input.status) && false === input.ok && "string" === typeof input.error; const _io3 = input => (undefined === input.exchangeID || "string" === typeof input.exchangeID) && (undefined === input.status || "completed" === input.status) && (undefined === input.blockhash || "string" === typeof input.blockhash) && false === input.ok && "string" === typeof input.error; const _iu0 = input => (() => {
|
|
28
39
|
if (_io0(input))
|
|
29
40
|
return _io0(input);
|
|
30
41
|
if (_io1(input))
|
|
@@ -47,7 +58,7 @@ export const assertKeetaNetTokenPublicKeyString = (() => { const __is = input =>
|
|
|
47
58
|
}
|
|
48
59
|
return input;
|
|
49
60
|
}; })();
|
|
50
|
-
export const assertConversionInputCanonicalJSON = (() => { const _io0 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity); const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
61
|
+
export const assertConversionInputCanonicalJSON = (() => { const _io0 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
51
62
|
method: "createAssert",
|
|
52
63
|
path: _path + ".from",
|
|
53
64
|
expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}`)",
|
|
@@ -67,6 +78,11 @@ export const assertConversionInputCanonicalJSON = (() => { const _io0 = input =>
|
|
|
67
78
|
path: _path + ".affinity",
|
|
68
79
|
expected: "(\"from\" | \"to\")",
|
|
69
80
|
value: input.affinity
|
|
81
|
+
}, _errorFactory)) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
82
|
+
method: "createAssert",
|
|
83
|
+
path: _path + ".preferredCostAsset",
|
|
84
|
+
expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}` | undefined)",
|
|
85
|
+
value: input.preferredCostAsset
|
|
70
86
|
}, _errorFactory)); const __is = input => "object" === typeof input && null !== input && _io0(input); let _errorFactory; return (input, errorFactory) => {
|
|
71
87
|
if (false === __is(input)) {
|
|
72
88
|
_errorFactory = errorFactory;
|
|
@@ -84,7 +100,7 @@ export const assertConversionInputCanonicalJSON = (() => { const _io0 = input =>
|
|
|
84
100
|
}
|
|
85
101
|
return input;
|
|
86
102
|
}; })();
|
|
87
|
-
export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const _io0 = input => "string" === typeof input.block && ("object" === typeof input.quote && null !== input.quote && _io1(input.quote)) && (null !== input.request && undefined === input.request); const _io1 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))) && "string" === typeof input.convertedAmount && ("object" === typeof input.cost && null !== input.cost && _io3(input.cost)) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io2 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity); const _io3 = input => "string" === typeof input.amount && ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token))); const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _io5 = input => "string" === typeof input.block && (null !== input.quote && undefined === input.quote) && ("object" === typeof input.request && null !== input.request && _io6(input.request)); const _io6 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity); const _iu0 = input => (() => {
|
|
103
|
+
export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const _io0 = input => "string" === typeof input.block && ("object" === typeof input.quote && null !== input.quote && _io1(input.quote)) && (null !== input.request && undefined === input.request); const _io1 = input => "object" === typeof input.request && null !== input.request && _io2(input.request) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))) && "string" === typeof input.convertedAmount && ("object" === typeof input.cost && null !== input.cost && _io3(input.cost)) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io2 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _io3 = input => "string" === typeof input.amount && ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token))); const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _io5 = input => "string" === typeof input.block && (null !== input.quote && undefined === input.quote) && ("object" === typeof input.request && null !== input.request && _io6(input.request)); const _io6 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _iu0 = input => (() => {
|
|
88
104
|
if ("object" === typeof input.request && null !== input.request && _io6(input.request))
|
|
89
105
|
return _io5(input);
|
|
90
106
|
else if ("object" === typeof input.quote && null !== input.quote && _io1(input.quote))
|
|
@@ -176,6 +192,11 @@ export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const
|
|
|
176
192
|
path: _path + ".affinity",
|
|
177
193
|
expected: "(\"from\" | \"to\")",
|
|
178
194
|
value: input.affinity
|
|
195
|
+
}, _errorFactory)) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
196
|
+
method: "createAssert",
|
|
197
|
+
path: _path + ".preferredCostAsset",
|
|
198
|
+
expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}` | undefined)",
|
|
199
|
+
value: input.preferredCostAsset
|
|
179
200
|
}, _errorFactory)); const _ao3 = (input, _path, _exceptionable = true) => ("string" === typeof input.amount || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
180
201
|
method: "createAssert",
|
|
181
202
|
path: _path + ".amount",
|
|
@@ -246,6 +267,11 @@ export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const
|
|
|
246
267
|
path: _path + ".affinity",
|
|
247
268
|
expected: "(\"from\" | \"to\")",
|
|
248
269
|
value: input.affinity
|
|
270
|
+
}, _errorFactory)) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
271
|
+
method: "createAssert",
|
|
272
|
+
path: _path + ".preferredCostAsset",
|
|
273
|
+
expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}` | undefined)",
|
|
274
|
+
value: input.preferredCostAsset
|
|
249
275
|
}, _errorFactory)); const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
250
276
|
if ("object" === typeof input.request && null !== input.request && _ao6(input.request, _path + ".request", false && _exceptionable))
|
|
251
277
|
return _ao5(input, _path, true && _exceptionable);
|
|
@@ -255,7 +281,7 @@ export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const
|
|
|
255
281
|
return __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
256
282
|
method: "createAssert",
|
|
257
283
|
path: _path,
|
|
258
|
-
expected: "({ block: string; } & { quote?: undefined; request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; }; } | { block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed
|
|
284
|
+
expected: "({ block: string; } & { quote?: undefined; request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; } | { block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed...)",
|
|
259
285
|
value: input
|
|
260
286
|
}, _errorFactory);
|
|
261
287
|
})(); const __is = input => "object" === typeof input && null !== input && _iu0(input); let _errorFactory; return (input, errorFactory) => {
|
|
@@ -264,12 +290,12 @@ export const assertKeetaFXAnchorClientCreateExchangeRequestJSON = (() => { const
|
|
|
264
290
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || __typia_transform__assertGuard._assertGuard(true, {
|
|
265
291
|
method: "createAssert",
|
|
266
292
|
path: _path + "",
|
|
267
|
-
expected: "({ block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed
|
|
293
|
+
expected: "({ block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed... | { block: string; } & { quote?: undefined; request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; })",
|
|
268
294
|
value: input
|
|
269
295
|
}, _errorFactory)) && _au0(input, _path + "", true) || __typia_transform__assertGuard._assertGuard(true, {
|
|
270
296
|
method: "createAssert",
|
|
271
297
|
path: _path + "",
|
|
272
|
-
expected: "({ block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed
|
|
298
|
+
expected: "({ block: string; } & { quote: { request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; account: TokenPublicKeyString | ... 5 more ... | MultisigPublicKeyString; convertedAmount: string; cost: { ...; }; signed... | { block: string; } & { quote?: undefined; request: { from: TokenPublicKeyString; to: TokenPublicKeyString; amount: string; affinity: \"from\" | \"to\"; preferredCostAsset?: TokenPublicKeyString | undefined; }; })",
|
|
273
299
|
value: input
|
|
274
300
|
}, _errorFactory))(input, "$input", true);
|
|
275
301
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/fx/common.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EACN,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AA+L5B,MAAM,CAAC,MAAM,+BAA+B;;;;;;;;;;;;;;sFAAwG,CAAC;AACrJ,MAAM,CAAC,MAAM,4BAA4B;;;;;;;sFAAkG,CAAC;AAC5I,MAAM,CAAC,MAAM,+BAA+B;;;;;;;;;;sFAAwG,CAAC;AACrJ,MAAM,CAAC,MAAM,kCAAkC;;;;;;;;;;;OAAkG,CAAC;AAClJ,MAAM,CAAC,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAiG,CAAC;AACjJ,MAAM,CAAC,MAAM,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAiI,CAAC;AAEjM,MAAM,uCAAwC,SAAQ,oBAAoB;IACzE,MAAM,CAAmB,IAAI,GAAW,yCAAyC,CAAC;IACjE,m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O,CAAC,CAAC;QAChC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;;AAGF,MAAM,CAAC,MAAM,MAAM,GAIf;IACH;;OAEG;IACH,qBAAqB,EAAE,uCAAuC;IAE9D;;OAEG;IACH,aAAa,EAAE,+BAA+B;IAE9C;;OAEG;IACH,qBAAqB,EAAE,uCAAuC;CAC9D,CAAC","sourcesContent":["import type { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nimport type { ServiceSearchCriteria } from '../../lib/resolver.js';\nimport type { ToJSONSerializable } from '../../lib/utils/json.js';\nimport { createAssert, createIs } from 'typia';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\n\nexport type KeetaNetAccount = InstanceType<typeof KeetaNetLib.Account>;\nexport type KeetaNetStorageAccount = InstanceType<typeof KeetaNetLib.Account<typeof KeetaNetLib.Account.AccountKeyAlgorithm.STORAGE>>;\nexport type KeetaNetToken = InstanceType<typeof KeetaNetLib.Account<typeof KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN>>;\nexport type KeetaNetTokenPublicKeyString = ReturnType<InstanceType<typeof KeetaNetLib.Account<typeof KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN>>['publicKeyString']['get']>;\n\nexport type ConversionInput = {\n\t/**\n\t * The currency code to convert from (i.e., what the user has).\n\t */\n\tfrom: ServiceSearchCriteria<'fx'>['inputCurrencyCode'] | KeetaNetToken;\n\t/**\n\t * The currency code to convert to (i.e., what the user wants).\n\t */\n\tto: ServiceSearchCriteria<'fx'>['outputCurrencyCode'] | KeetaNetToken;\n\t/**\n\t * The amount to convert. This is a bigint representing the\n\t * amount in the currency specified by either `from` or `to`, as\n\t * specified by the `affinity` property.\n\t */\n\tamount: bigint;\n\t/**\n\t * Indicates whether the amount specified is in terms of the `from`\n\t * currency (i.e., the user has this much) or the `to` currency\n\t * (i.e., the user wants this much).\n\t */\n\taffinity: 'from' | 'to';\n};\n\nexport type ConversionInputCanonical = {\n\t[k in keyof ConversionInput]: k extends 'amount' ? bigint : k extends 'from' ? KeetaNetToken : k extends 'to' ? KeetaNetToken : ConversionInput[k];\n};\n\nexport type ConversionInputCanonicalJSON = ToJSONSerializable<ConversionInputCanonical>;\n\nexport type KeetaFXAnchorClientCreateExchangeRequest = {\n\tblock: InstanceType<typeof KeetaNetLib.Block>;\n} & ({\n\tquote: KeetaFXAnchorQuote;\n} | {\n\trequest: ConversionInputCanonical;\n});\n\nexport type KeetaFXAnchorClientCreateExchangeRequestJSON = {\n\tblock: string;\n} & ({\n\tquote: KeetaFXAnchorQuoteJSON;\n\trequest?: undefined;\n} | {\n\tquote?: undefined;\n\trequest: ConversionInputCanonicalJSON;\n})\n\nexport type KeetaFXAnchorEstimate = {\n\t/**\n\t * Conversion request that was provided\n\t */\n\trequest: ConversionInputCanonical;\n\n\t/**\n\t * Amount after the conversion as specified by either `from` or `to`, as specified by the `affinity` property in the request.\n\t */\n\tconvertedAmount: bigint;\n\n\t/**\n\t * Outer bound of the converted amount.\n\t * if affinity is 'to', this is the maximum amount the user would need to send, if its 'from', this is the minimum amount the user would receive.\n\t */\n\tconvertedAmountBound?: bigint;\n\n\t/**\n\t * The expected cost of the fx request, in the form of a\n\t * token and a range of minimum and maximum expected costs\n\t */\n\texpectedCost: {\n\t\tmin: bigint;\n\t\tmax: bigint;\n\t\ttoken: KeetaNetToken;\n\t};\n} & (\n\t{\n\t\t/**\n\t\t * Indicates that the exchange cannot be performed if false, and no quote can be issued\n\t\t */\n\t\tcanPerformExchange: false;\n\t} | ({\n\t\t/**\n\t\t * Indicates that the exchange can be performed if true or undefined, but a quote may or may not be required before proceeding with the exchange\n\t\t */\n\t\tcanPerformExchange?: true;\n\t} & ({\n\t\t/**\n\t\t * Indicates that a quote is required before proceeding with the exchange\n\t\t */\n\t\trequiresQuote: false;\n\n\t\t/**\n\t\t * Liquidity provider account if the user is not going to request a quote before the exchange\n\t\t */\n\t\taccount: KeetaNetAccount | KeetaNetStorageAccount;\n\t} | {\n\t\t/**\n\t\t * Indicates that a quote is required before proceeding with the exchange, defaults to true\n\t\t */\n\t\trequiresQuote?: true;\n\t}))\n);\n\nexport type KeetaFXAnchorEstimateResponse = ({\n\tok: true;\n\testimate: ToJSONSerializable<KeetaFXAnchorEstimate>;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaFXAnchorQuote = {\n\t/**\n\t * Conversion request that was provided\n\t */\n\trequest: ConversionInputCanonical;\n\n\t/**\n\t * The public key of the liquidity provider account\n\t */\n\taccount: KeetaNetAccount | KeetaNetStorageAccount;\n\n\t/**\n\t * Amount after the conversion as specified by either `from` or `to`, as specified by the `affinity` property in the request.\n\t */\n\tconvertedAmount: bigint;\n\n\t/**\n\t * The cost of the fx request, in the form of a\n\t * token and amount that should be included with the swap\n\t */\n\tcost: {\n\t\tamount: bigint;\n\t\ttoken: KeetaNetToken;\n\t};\n\n\t/**\n\t * Signature information to verify the quote\n\t */\n\tsigned: HTTPSignedField;\n};\n\nexport type KeetaFXAnchorQuoteJSON = ToJSONSerializable<KeetaFXAnchorQuote>;\n\nexport type KeetaFXAnchorQuoteResponse = ({\n\tok: true;\n\tquote: ToJSONSerializable<KeetaFXAnchorQuote>\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaFXAnchorExchange = {\n\t/**\n\t * ID used to identify the conversion request\n\t */\n\texchangeID: string\n} & ({\n\t/**\n\t * Status of the exchange request\n\t */\n\tstatus: 'pending' | 'failed';\n} | {\n\t/**\n\t * Status of the exchange request\n\t */\n\tstatus: 'completed';\n\t/**\n\t * Blockhash where the exchange was completed -- the user-supplied\n\t * blockhash for their portion of the exchange transaction can be\n\t * used to look up the transaction on-chain as well, but we return\n\t * a value here so that it can be looked up without needing to store\n\t * that initial block.\n\t */\n\tblockhash: string;\n});\n\nexport type KeetaFXAnchorExchangeResponse = (KeetaFXAnchorExchange & {\n\tok: true;\n}) | (Partial<KeetaFXAnchorExchange> & {\n\tok: false;\n\terror: string;\n});\n\nexport const isKeetaFXAnchorEstimateResponse: (input: unknown) => input is KeetaFXAnchorEstimateResponse = createIs<KeetaFXAnchorEstimateResponse>();\nexport const isKeetaFXAnchorQuoteResponse: (input: unknown) => input is KeetaFXAnchorQuoteResponse = createIs<KeetaFXAnchorQuoteResponse>();\nexport const isKeetaFXAnchorExchangeResponse: (input: unknown) => input is KeetaFXAnchorExchangeResponse = createIs<KeetaFXAnchorExchangeResponse>();\nexport const assertKeetaNetTokenPublicKeyString: (input: unknown) => KeetaNetTokenPublicKeyString = createAssert<KeetaNetTokenPublicKeyString>();\nexport const assertConversionInputCanonicalJSON: (input: unknown) => ConversionInputCanonicalJSON = createAssert<ConversionInputCanonicalJSON>();\nexport const assertKeetaFXAnchorClientCreateExchangeRequestJSON: (input: unknown) => KeetaFXAnchorClientCreateExchangeRequestJSON = createAssert<KeetaFXAnchorClientCreateExchangeRequestJSON>();\n\nclass KeetaFXAnchorQuoteValidationFailedError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteValidationFailedError';\n\tprivate readonly KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID = 'a8f3c2d1-9b4e-4f2a-8c1d-5e6f7a8b9c0d';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Quote validation failed');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteValidationFailedError.KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteValidationFailedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID', KeetaFXAnchorQuoteValidationFailedError.KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaFXAnchorQuoteRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteRequiredError';\n\tprivate readonly KeetaFXAnchorQuoteRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteRequiredErrorObjectTypeID = '9f22067f-52b3-40f2-84c1-ad9285260980';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Quote required to perform exchange');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteRequiredError.KeetaFXAnchorQuoteRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteRequiredErrorObjectTypeID', KeetaFXAnchorQuoteRequiredError.KeetaFXAnchorQuoteRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaFXAnchorQuoteIssuanceDisabledError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteIssuanceDisabledError';\n\tprivate readonly KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID = 'a0f70c0b-6e17-41f0-825a-d086983209e1';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Anchor cannot issue quotes');\n\t\tthis.statusCode = 501;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteIssuanceDisabledError.KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteIssuanceDisabledError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID', KeetaFXAnchorQuoteIssuanceDisabledError.KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport const Errors: {\n\tQuoteValidationFailed: typeof KeetaFXAnchorQuoteValidationFailedError;\n\tQuoteRequired: typeof KeetaFXAnchorQuoteRequiredError;\n\tQuoteIssuanceDisabled: typeof KeetaFXAnchorQuoteIssuanceDisabledError;\n} = {\n\t/**\n\t * The quote validation failed\n\t */\n\tQuoteValidationFailed: KeetaFXAnchorQuoteValidationFailedError,\n\n\t/**\n\t * Quote is required to perform the exchange\n\t */\n\tQuoteRequired: KeetaFXAnchorQuoteRequiredError,\n\n\t/**\n\t * The anchor cannot issue quotes\n\t */\n\tQuoteIssuanceDisabled: KeetaFXAnchorQuoteIssuanceDisabledError\n};\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/fx/common.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAInE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC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AM,MAAM,GAIf;IACH;;OAEG;IACH,qBAAqB,EAAE,uCAAuC;IAE9D;;OAEG;IACH,aAAa,EAAE,+BAA+B;IAE9C;;OAEG;IACH,qBAAqB,EAAE,uCAAuC;CAC9D,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nimport type { ServiceSearchCriteria } from '../../lib/resolver.js';\nimport type { ToJSONSerializable } from '../../lib/utils/json.js';\nimport { createAssert, createIs } from 'typia';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type {\n\tKeetaNetAccount,\n\tKeetaNetStorageAccount,\n\tKeetaNetToken,\n\tKeetaNetTokenPublicKeyString\n} from '../../lib/asset.js';\n\nexport type {\n\tKeetaNetAccount,\n\tKeetaNetStorageAccount,\n\tKeetaNetToken,\n\tKeetaNetTokenPublicKeyString\n} from '../../lib/asset.js';\n\n/**\n * Parses a cost token from its serialized public key string form,\n * reconstituting a KeetaNetToken instance.\n */\nexport function parseFXCostToken(input: KeetaNetToken | string): KeetaNetToken {\n\tif (KeetaNetLib.Account.isInstance(input)) {\n\t\treturn(input);\n\t}\n\n\treturn(KeetaNetLib.Account.fromPublicKeyString(input).assertKeyType(KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN));\n}\n\nexport type ConversionInput = {\n\t/**\n\t * The currency code to convert from (i.e., what the user has).\n\t */\n\tfrom: ServiceSearchCriteria<'fx'>['inputCurrencyCode'] | KeetaNetToken;\n\t/**\n\t * The currency code to convert to (i.e., what the user wants).\n\t */\n\tto: ServiceSearchCriteria<'fx'>['outputCurrencyCode'] | KeetaNetToken;\n\t/**\n\t * The amount to convert. This is a bigint representing the\n\t * amount in the currency specified by either `from` or `to`, as\n\t * specified by the `affinity` property.\n\t */\n\tamount: bigint;\n\t/**\n\t * Indicates whether the amount specified is in terms of the `from`\n\t * currency (i.e., the user has this much) or the `to` currency\n\t * (i.e., the user wants this much).\n\t */\n\taffinity: 'from' | 'to';\n\n\t/**\n\t * Optional preferred token in which the fee/cost should be\n\t * denominated. Must be one of the operator's advertised\n\t * acceptedCostAssets, if specified.\n\t */\n\tpreferredCostAsset?: KeetaNetTokenPublicKeyString;\n};\n\nexport type ConversionInputCanonical = {\n\t[k in keyof ConversionInput]: k extends 'amount' ? bigint : k extends 'from' ? KeetaNetToken : k extends 'to' ? KeetaNetToken : ConversionInput[k];\n};\n\nexport type ConversionInputCanonicalJSON = ToJSONSerializable<ConversionInputCanonical>;\n\nexport type KeetaFXAnchorClientCreateExchangeRequest = {\n\tblock: InstanceType<typeof KeetaNetLib.Block>;\n} & ({\n\tquote: KeetaFXAnchorQuote;\n} | {\n\trequest: ConversionInputCanonical;\n});\n\nexport type KeetaFXAnchorClientCreateExchangeRequestJSON = {\n\tblock: string;\n} & ({\n\tquote: KeetaFXAnchorQuoteJSON;\n\trequest?: undefined;\n} | {\n\tquote?: undefined;\n\trequest: ConversionInputCanonicalJSON;\n})\n\nexport type KeetaFXAnchorEstimate = {\n\t/**\n\t * Conversion request that was provided\n\t */\n\trequest: ConversionInputCanonical;\n\n\t/**\n\t * Amount after the conversion as specified by either `from` or `to`, as specified by the `affinity` property in the request.\n\t */\n\tconvertedAmount: bigint;\n\n\t/**\n\t * Outer bound of the converted amount.\n\t * if affinity is 'to', this is the maximum amount the user would need to send, if its 'from', this is the minimum amount the user would receive.\n\t */\n\tconvertedAmountBound?: bigint;\n\n\t/**\n\t * The expected cost of the fx request, in the form of a\n\t * token and a range of minimum and maximum expected costs\n\t */\n\texpectedCost: {\n\t\tmin: bigint;\n\t\tmax: bigint;\n\t\ttoken: KeetaNetToken;\n\t};\n} & (\n\t{\n\t\t/**\n\t\t * Indicates that the exchange cannot be performed if false, and no quote can be issued\n\t\t */\n\t\tcanPerformExchange: false;\n\t} | ({\n\t\t/**\n\t\t * Indicates that the exchange can be performed if true or undefined, but a quote may or may not be required before proceeding with the exchange\n\t\t */\n\t\tcanPerformExchange?: true;\n\t} & ({\n\t\t/**\n\t\t * Indicates that a quote is required before proceeding with the exchange\n\t\t */\n\t\trequiresQuote: false;\n\n\t\t/**\n\t\t * Liquidity provider account if the user is not going to request a quote before the exchange\n\t\t */\n\t\taccount: KeetaNetAccount | KeetaNetStorageAccount;\n\t} | {\n\t\t/**\n\t\t * Indicates that a quote is required before proceeding with the exchange, defaults to true\n\t\t */\n\t\trequiresQuote?: true;\n\t}))\n);\n\nexport type KeetaFXAnchorEstimateResponse = ({\n\tok: true;\n\testimate: ToJSONSerializable<KeetaFXAnchorEstimate>;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaFXAnchorQuote = {\n\t/**\n\t * Conversion request that was provided\n\t */\n\trequest: ConversionInputCanonical;\n\n\t/**\n\t * The public key of the liquidity provider account\n\t */\n\taccount: KeetaNetAccount | KeetaNetStorageAccount;\n\n\t/**\n\t * Amount after the conversion as specified by either `from` or `to`, as specified by the `affinity` property in the request.\n\t */\n\tconvertedAmount: bigint;\n\n\t/**\n\t * The cost of the fx request, in the form of a\n\t * token and amount that should be included with the swap\n\t */\n\tcost: {\n\t\tamount: bigint;\n\t\ttoken: KeetaNetToken;\n\t};\n\n\t/**\n\t * Signature information to verify the quote\n\t */\n\tsigned: HTTPSignedField;\n};\n\nexport type KeetaFXAnchorQuoteJSON = ToJSONSerializable<KeetaFXAnchorQuote>;\n\nexport type KeetaFXAnchorQuoteResponse = ({\n\tok: true;\n\tquote: ToJSONSerializable<KeetaFXAnchorQuote>\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaFXAnchorExchange = {\n\t/**\n\t * ID used to identify the conversion request\n\t */\n\texchangeID: string\n} & ({\n\t/**\n\t * Status of the exchange request\n\t */\n\tstatus: 'pending' | 'failed';\n} | {\n\t/**\n\t * Status of the exchange request\n\t */\n\tstatus: 'completed';\n\t/**\n\t * Blockhash where the exchange was completed -- the user-supplied\n\t * blockhash for their portion of the exchange transaction can be\n\t * used to look up the transaction on-chain as well, but we return\n\t * a value here so that it can be looked up without needing to store\n\t * that initial block.\n\t */\n\tblockhash: string;\n});\n\nexport type KeetaFXAnchorExchangeResponse = (KeetaFXAnchorExchange & {\n\tok: true;\n}) | (Partial<KeetaFXAnchorExchange> & {\n\tok: false;\n\terror: string;\n});\n\nexport const isKeetaFXAnchorEstimateResponse: (input: unknown) => input is KeetaFXAnchorEstimateResponse = createIs<KeetaFXAnchorEstimateResponse>();\nexport const isKeetaFXAnchorQuoteResponse: (input: unknown) => input is KeetaFXAnchorQuoteResponse = createIs<KeetaFXAnchorQuoteResponse>();\nexport const isKeetaFXAnchorExchangeResponse: (input: unknown) => input is KeetaFXAnchorExchangeResponse = createIs<KeetaFXAnchorExchangeResponse>();\nexport const assertKeetaNetTokenPublicKeyString: (input: unknown) => KeetaNetTokenPublicKeyString = createAssert<KeetaNetTokenPublicKeyString>();\nexport const assertConversionInputCanonicalJSON: (input: unknown) => ConversionInputCanonicalJSON = createAssert<ConversionInputCanonicalJSON>();\nexport const assertKeetaFXAnchorClientCreateExchangeRequestJSON: (input: unknown) => KeetaFXAnchorClientCreateExchangeRequestJSON = createAssert<KeetaFXAnchorClientCreateExchangeRequestJSON>();\n\nclass KeetaFXAnchorQuoteValidationFailedError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteValidationFailedError';\n\tprivate readonly KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID = 'a8f3c2d1-9b4e-4f2a-8c1d-5e6f7a8b9c0d';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Quote validation failed');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteValidationFailedError.KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteValidationFailedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID', KeetaFXAnchorQuoteValidationFailedError.KeetaFXAnchorQuoteValidationFailedErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaFXAnchorQuoteRequiredError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteRequiredError';\n\tprivate readonly KeetaFXAnchorQuoteRequiredErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteRequiredErrorObjectTypeID = '9f22067f-52b3-40f2-84c1-ad9285260980';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Quote required to perform exchange');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteRequiredErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteRequiredError.KeetaFXAnchorQuoteRequiredErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteRequiredError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteRequiredErrorObjectTypeID', KeetaFXAnchorQuoteRequiredError.KeetaFXAnchorQuoteRequiredErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nclass KeetaFXAnchorQuoteIssuanceDisabledError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaFXAnchorQuoteIssuanceDisabledError';\n\tprivate readonly KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID!: string;\n\tprivate static readonly KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID = 'a0f70c0b-6e17-41f0-825a-d086983209e1';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Anchor cannot issue quotes');\n\t\tthis.statusCode = 501;\n\n\t\tObject.defineProperty(this, 'KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID', {\n\t\t\tvalue: KeetaFXAnchorQuoteIssuanceDisabledError.KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaFXAnchorQuoteIssuanceDisabledError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID', KeetaFXAnchorQuoteIssuanceDisabledError.KeetaFXAnchorQuoteIssuanceDisabledErrorObjectTypeID));\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<InstanceType<typeof this>> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\t\tconst error = new this(message);\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport const Errors: {\n\tQuoteValidationFailed: typeof KeetaFXAnchorQuoteValidationFailedError;\n\tQuoteRequired: typeof KeetaFXAnchorQuoteRequiredError;\n\tQuoteIssuanceDisabled: typeof KeetaFXAnchorQuoteIssuanceDisabledError;\n} = {\n\t/**\n\t * The quote validation failed\n\t */\n\tQuoteValidationFailed: KeetaFXAnchorQuoteValidationFailedError,\n\n\t/**\n\t * Quote is required to perform the exchange\n\t */\n\tQuoteRequired: KeetaFXAnchorQuoteRequiredError,\n\n\t/**\n\t * The anchor cannot issue quotes\n\t */\n\tQuoteIssuanceDisabled: KeetaFXAnchorQuoteIssuanceDisabledError\n};\n"]}
|
package/services/fx/server.d.ts
CHANGED
|
@@ -84,6 +84,12 @@ export interface KeetaAnchorFXServerConfig extends KeetaAnchorHTTPServer.KeetaAn
|
|
|
84
84
|
* Supported conversions
|
|
85
85
|
*/
|
|
86
86
|
from?: NonNullable<ServiceMetadata['services']['fx']>[string]['from'];
|
|
87
|
+
/**
|
|
88
|
+
* Asset identifiers in which this FX provider accepts fee
|
|
89
|
+
* denomination. Advertised in service metadata so clients
|
|
90
|
+
* can select a preferred cost asset.
|
|
91
|
+
*/
|
|
92
|
+
acceptedCostAssets?: NonNullable<ServiceMetadata['services']['fx']>[string]['acceptedCostAssets'];
|
|
87
93
|
/**
|
|
88
94
|
* Optional callback to validate a quote before completing an exchange
|
|
89
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/services/fx/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUjD,OAAO,KAAK,EACX,4BAA4B,EAC5B,qBAAqB,EAGrB,kBAAkB,EAClB,sBAAsB,EAEtB,eAAe,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAuC,MAAM,0BAA0B,CAAC;AACvG,OAAO,KAAK,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,yCAAyC,EAAE,MAAM,0BAA0B,CAAC;AACpJ,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,yBAAyB,CAAC;AAEpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAkB7D,MAAM,MAAM,8BAA8B,GAAG;IAC5C;;;;OAIG;IACH,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC;CAC9B,GAAG;IACH;;;OAGG;IACH,OAAO,EAA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/D,QAAQ,CAAC,EAAE,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IAEjG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,cAAc,UAAS;gBAErB,MAAM,EAAE,yBAAyB;cAqE7B,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC;IAwSrF,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAa3F,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAK3B"}
|
package/services/fx/server.js
CHANGED
|
@@ -35,6 +35,9 @@ async function formatQuoteSignable(unsignedQuote) {
|
|
|
35
35
|
unsignedQuote.cost.token,
|
|
36
36
|
unsignedQuote.cost.amount
|
|
37
37
|
];
|
|
38
|
+
if (unsignedQuote.request.preferredCostAsset !== undefined) {
|
|
39
|
+
retval.push(unsignedQuote.request.preferredCostAsset);
|
|
40
|
+
}
|
|
38
41
|
return (retval);
|
|
39
42
|
}
|
|
40
43
|
async function generateSignedQuote(signer, unsignedQuote) {
|
|
@@ -125,14 +128,20 @@ function encodeKeetaFXAnchorQueueStage1Request(request) {
|
|
|
125
128
|
};
|
|
126
129
|
}
|
|
127
130
|
;
|
|
128
|
-
const
|
|
131
|
+
const { preferredCostAsset, ...requestBase } = request.request;
|
|
132
|
+
const requestForQueue = { ...requestBase };
|
|
133
|
+
if (preferredCostAsset !== undefined) {
|
|
134
|
+
requestForQueue.preferredCostAsset = preferredCostAsset;
|
|
135
|
+
}
|
|
136
|
+
const account = request.account.publicKeyString.get();
|
|
137
|
+
const block = Buffer.from(request.block.toBytes()).toString('base64');
|
|
138
|
+
return ({
|
|
129
139
|
version: 1,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
expected
|
|
134
|
-
};
|
|
135
|
-
return (retval);
|
|
140
|
+
request: requestForQueue,
|
|
141
|
+
account,
|
|
142
|
+
block,
|
|
143
|
+
expected
|
|
144
|
+
});
|
|
136
145
|
}
|
|
137
146
|
function decodeKeetaFXAnchorQueueStage1Request(request) {
|
|
138
147
|
/* See note at bottom of file */
|
|
@@ -318,6 +327,22 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
|
|
|
318
327
|
error: 'Server misconfiguration: getConversionRateAndFee must be provided in fx configuration to process exchanges without expected details'
|
|
319
328
|
});
|
|
320
329
|
}
|
|
330
|
+
if (request.preferredCostAsset !== undefined) {
|
|
331
|
+
if (this.serverConfig.fx.acceptedCostAssets === undefined) {
|
|
332
|
+
return ({
|
|
333
|
+
status: 'failed_permanently',
|
|
334
|
+
output: null,
|
|
335
|
+
error: 'This server does not support preferred cost asset selection'
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
if (!this.serverConfig.fx.acceptedCostAssets.includes(request.preferredCostAsset)) {
|
|
339
|
+
return ({
|
|
340
|
+
status: 'failed_permanently',
|
|
341
|
+
output: null,
|
|
342
|
+
error: `Preferred cost asset "${request.preferredCostAsset}" is not accepted by this server`
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
321
346
|
const quote = await this.serverConfig.fx.getConversionRateAndFee(request, { purpose: 'exchange', request: entry.request });
|
|
322
347
|
const { refunds } = assertExchangeBlockParametersAndComputeRefund({
|
|
323
348
|
block: block,
|
|
@@ -626,6 +651,14 @@ class BaseKeetaNetFXAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAncho
|
|
|
626
651
|
if (purpose !== 'estimate' && !this.canPerformExchanges) {
|
|
627
652
|
throw (new Error(`FX configuration does not support performing exchanges, so purpose "${purpose}" is invalid`));
|
|
628
653
|
}
|
|
654
|
+
if (conversion.preferredCostAsset !== undefined) {
|
|
655
|
+
if (this.fx.acceptedCostAssets === undefined) {
|
|
656
|
+
throw (new KeetaAnchorUserError('This server does not support preferred cost asset selection'));
|
|
657
|
+
}
|
|
658
|
+
if (!this.fx.acceptedCostAssets.includes(conversion.preferredCostAsset)) {
|
|
659
|
+
throw (new KeetaAnchorUserError(`Preferred cost asset "${conversion.preferredCostAsset}" is not accepted by this server`));
|
|
660
|
+
}
|
|
661
|
+
}
|
|
629
662
|
if ('getConversionRateAndFee' in this.fx) {
|
|
630
663
|
if (!this.accounts) {
|
|
631
664
|
throw (new Error('Accounts must be configured to use "getConversionRateAndFee" in fx configuration'));
|
|
@@ -741,10 +774,14 @@ class BaseKeetaNetFXAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAncho
|
|
|
741
774
|
const operations = {
|
|
742
775
|
getEstimate: (new URL('/api/getEstimate', this.url)).toString()
|
|
743
776
|
};
|
|
744
|
-
|
|
777
|
+
const metadata = {
|
|
745
778
|
from: this.fx.from ?? [],
|
|
746
779
|
operations: operations
|
|
747
|
-
}
|
|
780
|
+
};
|
|
781
|
+
if (this.fx.acceptedCostAssets) {
|
|
782
|
+
metadata.acceptedCostAssets = this.fx.acceptedCostAssets;
|
|
783
|
+
}
|
|
784
|
+
return (metadata);
|
|
748
785
|
}
|
|
749
786
|
}
|
|
750
787
|
export class KeetaNetFXAnchorEstimateHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
|
|
@@ -1121,7 +1158,7 @@ export class KeetaNetFXAnchorHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
|
|
|
1121
1158
|
* in a ".generated.ts" file but for simplicity of internal types
|
|
1122
1159
|
* we keep them here.
|
|
1123
1160
|
*/
|
|
1124
|
-
const assertKeetaFXAnchorQueueStage1RequestJSON = (() => { const _io0 = input => 1 === input.version && "string" === typeof input.account && "string" === typeof input.block && ("object" === typeof input.request && null !== input.request && _io1(input.request)) && (null === input.expected || "object" === typeof input.expected && null !== input.expected && _io2(input.expected)); const _io1 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity); const _io2 = input => "object" === typeof input.receive && null !== input.receive && _io3(input.receive) && ("object" === typeof input.send && null !== input.send && _io4(input.send)); const _io3 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _io4 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _ao0 = (input, _path, _exceptionable = true) => (1 === input.version || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1161
|
+
const assertKeetaFXAnchorQueueStage1RequestJSON = (() => { const _io0 = input => 1 === input.version && "string" === typeof input.account && "string" === typeof input.block && ("object" === typeof input.request && null !== input.request && _io1(input.request)) && (null === input.expected || "object" === typeof input.expected && null !== input.expected && _io2(input.expected)); const _io1 = input => "string" === typeof input.from && (RegExp(/^keeta_am(.*)/).test(input.from) || RegExp(/^keeta_an(.*)/).test(input.from) || RegExp(/^keeta_ao(.*)/).test(input.from) || RegExp(/^keeta_ap(.*)/).test(input.from) || RegExp(/^tyblocks_am(.*)/).test(input.from) || RegExp(/^tyblocks_an(.*)/).test(input.from) || RegExp(/^tyblocks_ao(.*)/).test(input.from) || RegExp(/^tyblocks_ap(.*)/).test(input.from)) && ("string" === typeof input.to && (RegExp(/^keeta_am(.*)/).test(input.to) || RegExp(/^keeta_an(.*)/).test(input.to) || RegExp(/^keeta_ao(.*)/).test(input.to) || RegExp(/^keeta_ap(.*)/).test(input.to) || RegExp(/^tyblocks_am(.*)/).test(input.to) || RegExp(/^tyblocks_an(.*)/).test(input.to) || RegExp(/^tyblocks_ao(.*)/).test(input.to) || RegExp(/^tyblocks_ap(.*)/).test(input.to))) && "string" === typeof input.amount && ("from" === input.affinity || "to" === input.affinity) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset))); const _io2 = input => "object" === typeof input.receive && null !== input.receive && _io3(input.receive) && ("object" === typeof input.send && null !== input.send && _io4(input.send)); const _io3 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _io4 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _ao0 = (input, _path, _exceptionable = true) => (1 === input.version || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1125
1162
|
method: "typia.createAssert",
|
|
1126
1163
|
path: _path + ".version",
|
|
1127
1164
|
expected: "1",
|
|
@@ -1176,6 +1213,11 @@ const assertKeetaFXAnchorQueueStage1RequestJSON = (() => { const _io0 = input =>
|
|
|
1176
1213
|
path: _path + ".affinity",
|
|
1177
1214
|
expected: "(\"from\" | \"to\")",
|
|
1178
1215
|
value: input.affinity
|
|
1216
|
+
}, _errorFactory)) && (undefined === input.preferredCostAsset || "string" === typeof input.preferredCostAsset && (RegExp(/^keeta_am(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_an(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^keeta_ap(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_am(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_an(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ao(.*)/).test(input.preferredCostAsset) || RegExp(/^tyblocks_ap(.*)/).test(input.preferredCostAsset)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1217
|
+
method: "typia.createAssert",
|
|
1218
|
+
path: _path + ".preferredCostAsset",
|
|
1219
|
+
expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}` | undefined)",
|
|
1220
|
+
value: input.preferredCostAsset
|
|
1179
1221
|
}, _errorFactory)); const _ao2 = (input, _path, _exceptionable = true) => (("object" === typeof input.receive && null !== input.receive || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1180
1222
|
method: "typia.createAssert",
|
|
1181
1223
|
path: _path + ".receive",
|