@chainflip/sdk 1.2.0-rc.0 → 1.2.0-rc.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/dist/{broker-MHEH3K4E.mjs → broker-AQ4TYGXK.mjs} +10 -8
- package/dist/chunk-TKSJD3PK.mjs +28 -0
- package/dist/{chunk-Q7HQVR3T.mjs → chunk-XMGPLWGR.mjs} +600 -21
- package/dist/{chunk-PDTD3K27.mjs → chunk-ZIIOHBEG.mjs} +2 -1
- package/dist/funding.js +585 -23
- package/dist/funding.mjs +2 -2
- package/dist/swap.d.mts +39 -16
- package/dist/swap.d.ts +39 -16
- package/dist/swap.js +28 -23
- package/dist/swap.mjs +20 -18
- package/package.json +1 -1
- package/dist/chunk-6H62DRRW.mjs +0 -606
package/dist/swap.d.mts
CHANGED
|
@@ -427,6 +427,7 @@ interface QuoteResponse extends QuoteRequest {
|
|
|
427
427
|
interface DepositAddressRequest extends QuoteRequest {
|
|
428
428
|
destAddress: string;
|
|
429
429
|
ccmMetadata?: CcmMetadata;
|
|
430
|
+
boostFeeBps?: number;
|
|
430
431
|
}
|
|
431
432
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
432
433
|
depositChannelId: string;
|
|
@@ -438,20 +439,8 @@ interface DepositAddressResponse extends DepositAddressRequest {
|
|
|
438
439
|
interface SwapStatusRequest {
|
|
439
440
|
id: string;
|
|
440
441
|
}
|
|
441
|
-
interface
|
|
442
|
-
srcAsset: Asset;
|
|
443
|
-
srcChain: Chain;
|
|
444
|
-
destAsset: Asset | undefined;
|
|
445
|
-
destChain: Chain | undefined;
|
|
442
|
+
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
446
443
|
destAddress: string;
|
|
447
|
-
depositAddress: string | undefined;
|
|
448
|
-
depositChannelCreatedAt: number | undefined;
|
|
449
|
-
depositChannelBrokerCommissionBps: number | undefined;
|
|
450
|
-
expectedDepositAmount: string | undefined;
|
|
451
|
-
depositChannelExpiryBlock: string | undefined;
|
|
452
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
453
|
-
isDepositChannelExpired: boolean | undefined;
|
|
454
|
-
depositChannelOpenedThroughBackend: boolean | undefined;
|
|
455
444
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
456
445
|
ccmMetadata: {
|
|
457
446
|
gasBudget: string;
|
|
@@ -459,7 +448,38 @@ interface CommonStatusFields {
|
|
|
459
448
|
} | undefined;
|
|
460
449
|
feesPaid: SwapFee[];
|
|
461
450
|
}
|
|
462
|
-
|
|
451
|
+
interface DepositAddressFields extends SwapStatusResponseCommonFields {
|
|
452
|
+
depositAddress: string;
|
|
453
|
+
depositChannelCreatedAt: number;
|
|
454
|
+
depositChannelBrokerCommissionBps: number;
|
|
455
|
+
expectedDepositAmount: string | undefined;
|
|
456
|
+
depositChannelExpiryBlock: string;
|
|
457
|
+
estimatedDepositChannelExpiryTime: number;
|
|
458
|
+
isDepositChannelExpired: boolean;
|
|
459
|
+
depositChannelOpenedThroughBackend: boolean;
|
|
460
|
+
}
|
|
461
|
+
type CopyFields<T, U> = {
|
|
462
|
+
[K in Exclude<keyof T, keyof U>]: undefined;
|
|
463
|
+
} & U;
|
|
464
|
+
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
|
|
465
|
+
type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
466
|
+
depositAmount: string;
|
|
467
|
+
depositTransactionHash: string;
|
|
468
|
+
destAddress: string;
|
|
469
|
+
error: {
|
|
470
|
+
message: string;
|
|
471
|
+
name: string;
|
|
472
|
+
};
|
|
473
|
+
failedAt: number;
|
|
474
|
+
failedBlockIndex: string;
|
|
475
|
+
failure: string;
|
|
476
|
+
feesPaid: [];
|
|
477
|
+
srcAsset: Asset;
|
|
478
|
+
srcChain: Chain;
|
|
479
|
+
state: 'FAILED';
|
|
480
|
+
depositAddress: undefined;
|
|
481
|
+
}>;
|
|
482
|
+
type SwapState = {
|
|
463
483
|
state: 'AWAITING_DEPOSIT';
|
|
464
484
|
depositAmount: string | undefined;
|
|
465
485
|
depositTransactionHash: string | undefined;
|
|
@@ -565,7 +585,10 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
565
585
|
ignoredEgressAmount: string;
|
|
566
586
|
egressIgnoredAt: number;
|
|
567
587
|
egressIgnoredBlockIndex: string;
|
|
568
|
-
}
|
|
588
|
+
};
|
|
589
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
590
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
591
|
+
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
569
592
|
|
|
570
593
|
type RequestOptions = {
|
|
571
594
|
signal?: AbortSignal;
|
|
@@ -606,4 +629,4 @@ declare class SwapSDK {
|
|
|
606
629
|
}>;
|
|
607
630
|
}
|
|
608
631
|
|
|
609
|
-
export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, chainAssets };
|
|
632
|
+
export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type VaultSwapStatusResponse, chainAssets };
|
package/dist/swap.d.ts
CHANGED
|
@@ -427,6 +427,7 @@ interface QuoteResponse extends QuoteRequest {
|
|
|
427
427
|
interface DepositAddressRequest extends QuoteRequest {
|
|
428
428
|
destAddress: string;
|
|
429
429
|
ccmMetadata?: CcmMetadata;
|
|
430
|
+
boostFeeBps?: number;
|
|
430
431
|
}
|
|
431
432
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
432
433
|
depositChannelId: string;
|
|
@@ -438,20 +439,8 @@ interface DepositAddressResponse extends DepositAddressRequest {
|
|
|
438
439
|
interface SwapStatusRequest {
|
|
439
440
|
id: string;
|
|
440
441
|
}
|
|
441
|
-
interface
|
|
442
|
-
srcAsset: Asset;
|
|
443
|
-
srcChain: Chain;
|
|
444
|
-
destAsset: Asset | undefined;
|
|
445
|
-
destChain: Chain | undefined;
|
|
442
|
+
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
446
443
|
destAddress: string;
|
|
447
|
-
depositAddress: string | undefined;
|
|
448
|
-
depositChannelCreatedAt: number | undefined;
|
|
449
|
-
depositChannelBrokerCommissionBps: number | undefined;
|
|
450
|
-
expectedDepositAmount: string | undefined;
|
|
451
|
-
depositChannelExpiryBlock: string | undefined;
|
|
452
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
453
|
-
isDepositChannelExpired: boolean | undefined;
|
|
454
|
-
depositChannelOpenedThroughBackend: boolean | undefined;
|
|
455
444
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
456
445
|
ccmMetadata: {
|
|
457
446
|
gasBudget: string;
|
|
@@ -459,7 +448,38 @@ interface CommonStatusFields {
|
|
|
459
448
|
} | undefined;
|
|
460
449
|
feesPaid: SwapFee[];
|
|
461
450
|
}
|
|
462
|
-
|
|
451
|
+
interface DepositAddressFields extends SwapStatusResponseCommonFields {
|
|
452
|
+
depositAddress: string;
|
|
453
|
+
depositChannelCreatedAt: number;
|
|
454
|
+
depositChannelBrokerCommissionBps: number;
|
|
455
|
+
expectedDepositAmount: string | undefined;
|
|
456
|
+
depositChannelExpiryBlock: string;
|
|
457
|
+
estimatedDepositChannelExpiryTime: number;
|
|
458
|
+
isDepositChannelExpired: boolean;
|
|
459
|
+
depositChannelOpenedThroughBackend: boolean;
|
|
460
|
+
}
|
|
461
|
+
type CopyFields<T, U> = {
|
|
462
|
+
[K in Exclude<keyof T, keyof U>]: undefined;
|
|
463
|
+
} & U;
|
|
464
|
+
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
|
|
465
|
+
type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
466
|
+
depositAmount: string;
|
|
467
|
+
depositTransactionHash: string;
|
|
468
|
+
destAddress: string;
|
|
469
|
+
error: {
|
|
470
|
+
message: string;
|
|
471
|
+
name: string;
|
|
472
|
+
};
|
|
473
|
+
failedAt: number;
|
|
474
|
+
failedBlockIndex: string;
|
|
475
|
+
failure: string;
|
|
476
|
+
feesPaid: [];
|
|
477
|
+
srcAsset: Asset;
|
|
478
|
+
srcChain: Chain;
|
|
479
|
+
state: 'FAILED';
|
|
480
|
+
depositAddress: undefined;
|
|
481
|
+
}>;
|
|
482
|
+
type SwapState = {
|
|
463
483
|
state: 'AWAITING_DEPOSIT';
|
|
464
484
|
depositAmount: string | undefined;
|
|
465
485
|
depositTransactionHash: string | undefined;
|
|
@@ -565,7 +585,10 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
565
585
|
ignoredEgressAmount: string;
|
|
566
586
|
egressIgnoredAt: number;
|
|
567
587
|
egressIgnoredBlockIndex: string;
|
|
568
|
-
}
|
|
588
|
+
};
|
|
589
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
590
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
591
|
+
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
569
592
|
|
|
570
593
|
type RequestOptions = {
|
|
571
594
|
signal?: AbortSignal;
|
|
@@ -606,4 +629,4 @@ declare class SwapSDK {
|
|
|
606
629
|
}>;
|
|
607
630
|
}
|
|
608
631
|
|
|
609
|
-
export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, chainAssets };
|
|
632
|
+
export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type VaultSwapStatusResponse, chainAssets };
|
package/dist/swap.js
CHANGED
|
@@ -166,12 +166,11 @@ function assert(condition, message) {
|
|
|
166
166
|
}
|
|
167
167
|
throw error;
|
|
168
168
|
}
|
|
169
|
-
var isString2,
|
|
169
|
+
var isString2, isTokenSwap, isTokenCall;
|
|
170
170
|
var init_guards = __esm({
|
|
171
171
|
"../shared/src/guards.ts"() {
|
|
172
172
|
init_enums();
|
|
173
173
|
isString2 = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
|
|
174
|
-
isNotNullish = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isNotNullish");
|
|
175
174
|
__name(assert, "assert");
|
|
176
175
|
isTokenSwap = /* @__PURE__ */ __name((params) => params.srcAsset !== exports.Assets.ETH, "isTokenSwap");
|
|
177
176
|
isTokenCall = /* @__PURE__ */ __name((params) => params.srcAsset !== exports.Assets.ETH, "isTokenCall");
|
|
@@ -4623,7 +4622,8 @@ var init_schemas = __esm({
|
|
|
4623
4622
|
destChain: chainflipChain,
|
|
4624
4623
|
destAddress: z.string(),
|
|
4625
4624
|
amount: numericString,
|
|
4626
|
-
ccmMetadata: ccmMetadataSchema.optional()
|
|
4625
|
+
ccmMetadata: ccmMetadataSchema.optional(),
|
|
4626
|
+
boostFeeBps: z.number().optional()
|
|
4627
4627
|
}).transform(({ amount, ...rest }) => ({
|
|
4628
4628
|
...rest,
|
|
4629
4629
|
expectedDepositAmount: amount
|
|
@@ -4645,7 +4645,7 @@ __export(broker_exports, {
|
|
|
4645
4645
|
requestSwapDepositAddress: () => requestSwapDepositAddress
|
|
4646
4646
|
});
|
|
4647
4647
|
async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
|
|
4648
|
-
const { srcAsset, srcChain, destAsset, destChain, destAddress } = swapRequest;
|
|
4648
|
+
const { srcAsset, srcChain, destAsset, destChain, destAddress, boostFeeBps } = swapRequest;
|
|
4649
4649
|
return makeRpcRequest(chainflipNetwork2, opts.url, "requestSwapDepositAddress", {
|
|
4650
4650
|
asset: srcAsset,
|
|
4651
4651
|
chain: srcChain
|
|
@@ -4655,14 +4655,13 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
|
|
|
4655
4655
|
}, submitAddress(destAsset, destAddress), opts.commissionBps, swapRequest.ccmMetadata && {
|
|
4656
4656
|
...swapRequest.ccmMetadata,
|
|
4657
4657
|
cfParameters: void 0
|
|
4658
|
-
});
|
|
4658
|
+
}, boostFeeBps);
|
|
4659
4659
|
}
|
|
4660
4660
|
var transformObjToSnakeCase, submitAddress, rpcResult, requestValidators, responseValidators, makeRpcRequest;
|
|
4661
4661
|
var init_broker = __esm({
|
|
4662
4662
|
"../shared/src/broker.ts"() {
|
|
4663
4663
|
init_lib();
|
|
4664
4664
|
init_enums();
|
|
4665
|
-
init_guards();
|
|
4666
4665
|
init_parsers();
|
|
4667
4666
|
init_schemas();
|
|
4668
4667
|
init_strings();
|
|
@@ -4711,14 +4710,16 @@ var init_broker = __esm({
|
|
|
4711
4710
|
hexString,
|
|
4712
4711
|
z.string()
|
|
4713
4712
|
]).optional()
|
|
4714
|
-
})).optional()
|
|
4715
|
-
|
|
4713
|
+
})).optional(),
|
|
4714
|
+
z.number().optional()
|
|
4715
|
+
]).transform(([a, b, c, d, e, f]) => [
|
|
4716
4716
|
a,
|
|
4717
4717
|
b,
|
|
4718
4718
|
c,
|
|
4719
4719
|
d,
|
|
4720
|
-
transformObjToSnakeCase(e)
|
|
4721
|
-
|
|
4720
|
+
transformObjToSnakeCase(e),
|
|
4721
|
+
f
|
|
4722
|
+
])
|
|
4722
4723
|
}), "requestValidators");
|
|
4723
4724
|
responseValidators = /* @__PURE__ */ __name((network) => ({
|
|
4724
4725
|
requestSwapDepositAddress: z.object({
|
|
@@ -4755,7 +4756,7 @@ var init_broker = __esm({
|
|
|
4755
4756
|
}
|
|
4756
4757
|
});
|
|
4757
4758
|
|
|
4758
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
4759
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
|
|
4759
4760
|
function identity(x) {
|
|
4760
4761
|
return x;
|
|
4761
4762
|
}
|
|
@@ -4834,7 +4835,7 @@ function observable(subscribe) {
|
|
|
4834
4835
|
}
|
|
4835
4836
|
__name(observable, "observable");
|
|
4836
4837
|
|
|
4837
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
4838
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable/index.mjs
|
|
4838
4839
|
function share(_opts) {
|
|
4839
4840
|
return (originalObserver) => {
|
|
4840
4841
|
let refCount = 0;
|
|
@@ -4939,7 +4940,7 @@ function observableToPromise(observable2) {
|
|
|
4939
4940
|
}
|
|
4940
4941
|
__name(observableToPromise, "observableToPromise");
|
|
4941
4942
|
|
|
4942
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
4943
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
|
|
4943
4944
|
function createChain(opts) {
|
|
4944
4945
|
return observable((observer) => {
|
|
4945
4946
|
function execute(index = 0, op = opts.op) {
|
|
@@ -4963,7 +4964,7 @@ function createChain(opts) {
|
|
|
4963
4964
|
}
|
|
4964
4965
|
__name(createChain, "createChain");
|
|
4965
4966
|
|
|
4966
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
4967
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
|
|
4967
4968
|
function invert(obj) {
|
|
4968
4969
|
const newObj = /* @__PURE__ */ Object.create(null);
|
|
4969
4970
|
for (const key in obj) {
|
|
@@ -5001,7 +5002,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
|
|
|
5001
5002
|
};
|
|
5002
5003
|
invert(TRPC_ERROR_CODES_BY_KEY);
|
|
5003
5004
|
|
|
5004
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
5005
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
|
|
5005
5006
|
invert(TRPC_ERROR_CODES_BY_KEY);
|
|
5006
5007
|
var noop = /* @__PURE__ */ __name(() => {
|
|
5007
5008
|
}, "noop");
|
|
@@ -5039,7 +5040,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
|
|
|
5039
5040
|
});
|
|
5040
5041
|
}, "createFlatProxy");
|
|
5041
5042
|
|
|
5042
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
5043
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
|
|
5043
5044
|
function isObject(value) {
|
|
5044
5045
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
5045
5046
|
}
|
|
@@ -5070,7 +5071,7 @@ function getCauseFromUnknown(cause) {
|
|
|
5070
5071
|
}
|
|
5071
5072
|
__name(getCauseFromUnknown, "getCauseFromUnknown");
|
|
5072
5073
|
|
|
5073
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5074
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
|
|
5074
5075
|
function isObject2(value) {
|
|
5075
5076
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
5076
5077
|
}
|
|
@@ -5123,7 +5124,7 @@ function transformResult(response, runtime) {
|
|
|
5123
5124
|
}
|
|
5124
5125
|
__name(transformResult, "transformResult");
|
|
5125
5126
|
|
|
5126
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5127
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
|
|
5127
5128
|
function isTRPCClientError(cause) {
|
|
5128
5129
|
return cause instanceof TRPCClientError || /**
|
|
5129
5130
|
* @deprecated
|
|
@@ -5181,7 +5182,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
|
|
|
5181
5182
|
__name(_TRPCClientError, "TRPCClientError");
|
|
5182
5183
|
var TRPCClientError = _TRPCClientError;
|
|
5183
5184
|
|
|
5184
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5185
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
|
|
5185
5186
|
var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
|
|
5186
5187
|
function getFetch(customFetchImpl) {
|
|
5187
5188
|
if (customFetchImpl) {
|
|
@@ -5325,7 +5326,7 @@ function httpRequest(opts) {
|
|
|
5325
5326
|
}
|
|
5326
5327
|
__name(httpRequest, "httpRequest");
|
|
5327
5328
|
|
|
5328
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5329
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
|
|
5329
5330
|
var throwFatalError = /* @__PURE__ */ __name(() => {
|
|
5330
5331
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
5331
5332
|
}, "throwFatalError");
|
|
@@ -5555,7 +5556,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
|
|
|
5555
5556
|
}, "batchRequester");
|
|
5556
5557
|
var httpBatchLink = createHTTPBatchLink(batchRequester);
|
|
5557
5558
|
|
|
5558
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5559
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/links/httpLink.mjs
|
|
5559
5560
|
function httpLinkFactory(factoryOpts) {
|
|
5560
5561
|
return (opts) => {
|
|
5561
5562
|
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
@@ -5607,7 +5608,7 @@ function httpLinkFactory(factoryOpts) {
|
|
|
5607
5608
|
}
|
|
5608
5609
|
__name(httpLinkFactory, "httpLinkFactory");
|
|
5609
5610
|
|
|
5610
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
5611
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/index.mjs
|
|
5611
5612
|
var _TRPCUntypedClient = class _TRPCUntypedClient {
|
|
5612
5613
|
$request({ type, input, path, context = {} }) {
|
|
5613
5614
|
const chain$ = createChain({
|
|
@@ -6962,6 +6963,7 @@ init_guards();
|
|
|
6962
6963
|
// ../shared/src/rpc/index.ts
|
|
6963
6964
|
init_lib();
|
|
6964
6965
|
init_enums();
|
|
6966
|
+
init_parsers();
|
|
6965
6967
|
var numberOrHex = z.union([
|
|
6966
6968
|
z.string(),
|
|
6967
6969
|
z.number()
|
|
@@ -7113,6 +7115,7 @@ var swapRate = z.object({
|
|
|
7113
7115
|
output: numberOrHex
|
|
7114
7116
|
});
|
|
7115
7117
|
createRequest("cf_swap_rate", swapRate);
|
|
7118
|
+
createRequest("state_getMetadata", hexString);
|
|
7116
7119
|
|
|
7117
7120
|
// ../shared/src/rpc/utils.ts
|
|
7118
7121
|
init_enums();
|
|
@@ -8873,7 +8876,8 @@ var _SwapSDK = class _SwapSDK {
|
|
|
8873
8876
|
id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
|
|
8874
8877
|
depositAddress: result.address,
|
|
8875
8878
|
brokerCommissionBps: this.brokerConfig.commissionBps,
|
|
8876
|
-
srcChainExpiryBlock: result.sourceChainExpiryBlock
|
|
8879
|
+
srcChainExpiryBlock: result.sourceChainExpiryBlock,
|
|
8880
|
+
boostFeeBps: depositAddressRequest.boostFeeBps
|
|
8877
8881
|
};
|
|
8878
8882
|
} else {
|
|
8879
8883
|
response = await this.trpc.openSwapDepositChannel.mutate(depositAddressRequest);
|
|
@@ -8883,6 +8887,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
8883
8887
|
depositChannelId: response.id,
|
|
8884
8888
|
depositAddress: response.depositAddress,
|
|
8885
8889
|
brokerCommissionBps: response.brokerCommissionBps,
|
|
8890
|
+
boostFeeBps: Number(response.boostFeeBps) || 0,
|
|
8886
8891
|
depositChannelExpiryBlock: response.srcChainExpiryBlock,
|
|
8887
8892
|
estimatedDepositChannelExpiryTime: response.estimatedExpiryTime
|
|
8888
8893
|
};
|
package/dist/swap.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getTokenContractAddress, getEnvironment, getVaultManagerContractAddress, approve, checkAllowance, Vault__factory, extractOverrides } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import { __name, z, Chains, Assets, ChainflipNetworks, assetChains, assetDecimals, isTestnet, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds } from './chunk-
|
|
4
|
-
export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-
|
|
1
|
+
import { getTokenContractAddress, getEnvironment, getVaultManagerContractAddress, approve, checkAllowance, Vault__factory, extractOverrides } from './chunk-ZIIOHBEG.mjs';
|
|
2
|
+
import { ccmMetadataSchema } from './chunk-TKSJD3PK.mjs';
|
|
3
|
+
import { __name, z, numericString, Chains, Assets, ethereumAddress, dotAddress, ChainflipNetworks, assetChains, assetDecimals, isTestnet, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, btcAddress } from './chunk-XMGPLWGR.mjs';
|
|
4
|
+
export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-XMGPLWGR.mjs';
|
|
5
5
|
import { decodeAddress } from '@polkadot/util-crypto';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
8
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
|
|
9
9
|
function identity(x) {
|
|
10
10
|
return x;
|
|
11
11
|
}
|
|
@@ -84,7 +84,7 @@ function observable(subscribe) {
|
|
|
84
84
|
}
|
|
85
85
|
__name(observable, "observable");
|
|
86
86
|
|
|
87
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
87
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable/index.mjs
|
|
88
88
|
function share(_opts) {
|
|
89
89
|
return (originalObserver) => {
|
|
90
90
|
let refCount = 0;
|
|
@@ -189,7 +189,7 @@ function observableToPromise(observable2) {
|
|
|
189
189
|
}
|
|
190
190
|
__name(observableToPromise, "observableToPromise");
|
|
191
191
|
|
|
192
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
192
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
|
|
193
193
|
function createChain(opts) {
|
|
194
194
|
return observable((observer) => {
|
|
195
195
|
function execute(index = 0, op = opts.op) {
|
|
@@ -213,7 +213,7 @@ function createChain(opts) {
|
|
|
213
213
|
}
|
|
214
214
|
__name(createChain, "createChain");
|
|
215
215
|
|
|
216
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
216
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
|
|
217
217
|
function invert(obj) {
|
|
218
218
|
const newObj = /* @__PURE__ */ Object.create(null);
|
|
219
219
|
for (const key in obj) {
|
|
@@ -251,7 +251,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
|
|
|
251
251
|
};
|
|
252
252
|
invert(TRPC_ERROR_CODES_BY_KEY);
|
|
253
253
|
|
|
254
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
254
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
|
|
255
255
|
invert(TRPC_ERROR_CODES_BY_KEY);
|
|
256
256
|
var noop = /* @__PURE__ */ __name(() => {
|
|
257
257
|
}, "noop");
|
|
@@ -289,7 +289,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
|
|
|
289
289
|
});
|
|
290
290
|
}, "createFlatProxy");
|
|
291
291
|
|
|
292
|
-
// ../../node_modules/.pnpm/@trpc+server@10.45.
|
|
292
|
+
// ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
|
|
293
293
|
function isObject(value) {
|
|
294
294
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
295
295
|
}
|
|
@@ -320,7 +320,7 @@ function getCauseFromUnknown(cause) {
|
|
|
320
320
|
}
|
|
321
321
|
__name(getCauseFromUnknown, "getCauseFromUnknown");
|
|
322
322
|
|
|
323
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
323
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
|
|
324
324
|
function isObject2(value) {
|
|
325
325
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
326
326
|
}
|
|
@@ -373,7 +373,7 @@ function transformResult(response, runtime) {
|
|
|
373
373
|
}
|
|
374
374
|
__name(transformResult, "transformResult");
|
|
375
375
|
|
|
376
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
376
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
|
|
377
377
|
function isTRPCClientError(cause) {
|
|
378
378
|
return cause instanceof TRPCClientError || /**
|
|
379
379
|
* @deprecated
|
|
@@ -431,7 +431,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
|
|
|
431
431
|
__name(_TRPCClientError, "TRPCClientError");
|
|
432
432
|
var TRPCClientError = _TRPCClientError;
|
|
433
433
|
|
|
434
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
434
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
|
|
435
435
|
var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
|
|
436
436
|
function getFetch(customFetchImpl) {
|
|
437
437
|
if (customFetchImpl) {
|
|
@@ -575,7 +575,7 @@ function httpRequest(opts) {
|
|
|
575
575
|
}
|
|
576
576
|
__name(httpRequest, "httpRequest");
|
|
577
577
|
|
|
578
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
578
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
|
|
579
579
|
var throwFatalError = /* @__PURE__ */ __name(() => {
|
|
580
580
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
581
581
|
}, "throwFatalError");
|
|
@@ -805,7 +805,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
|
|
|
805
805
|
}, "batchRequester");
|
|
806
806
|
var httpBatchLink = createHTTPBatchLink(batchRequester);
|
|
807
807
|
|
|
808
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
808
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/links/httpLink.mjs
|
|
809
809
|
function httpLinkFactory(factoryOpts) {
|
|
810
810
|
return (opts) => {
|
|
811
811
|
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
@@ -857,7 +857,7 @@ function httpLinkFactory(factoryOpts) {
|
|
|
857
857
|
}
|
|
858
858
|
__name(httpLinkFactory, "httpLinkFactory");
|
|
859
859
|
|
|
860
|
-
// ../../node_modules/.pnpm/@trpc+client@10.45.
|
|
860
|
+
// ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/index.mjs
|
|
861
861
|
var _TRPCUntypedClient = class _TRPCUntypedClient {
|
|
862
862
|
$request({ type, input, path, context = {} }) {
|
|
863
863
|
const chain$ = createChain({
|
|
@@ -2567,13 +2567,14 @@ var _SwapSDK = class _SwapSDK {
|
|
|
2567
2567
|
}, BigInt(amount));
|
|
2568
2568
|
let response;
|
|
2569
2569
|
if (this.brokerConfig !== void 0) {
|
|
2570
|
-
const { requestSwapDepositAddress } = await import('./broker-
|
|
2570
|
+
const { requestSwapDepositAddress } = await import('./broker-AQ4TYGXK.mjs');
|
|
2571
2571
|
const result = await requestSwapDepositAddress(depositAddressRequest, this.brokerConfig, this.network);
|
|
2572
2572
|
response = {
|
|
2573
2573
|
id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
|
|
2574
2574
|
depositAddress: result.address,
|
|
2575
2575
|
brokerCommissionBps: this.brokerConfig.commissionBps,
|
|
2576
|
-
srcChainExpiryBlock: result.sourceChainExpiryBlock
|
|
2576
|
+
srcChainExpiryBlock: result.sourceChainExpiryBlock,
|
|
2577
|
+
boostFeeBps: depositAddressRequest.boostFeeBps
|
|
2577
2578
|
};
|
|
2578
2579
|
} else {
|
|
2579
2580
|
response = await this.trpc.openSwapDepositChannel.mutate(depositAddressRequest);
|
|
@@ -2583,6 +2584,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
2583
2584
|
depositChannelId: response.id,
|
|
2584
2585
|
depositAddress: response.depositAddress,
|
|
2585
2586
|
brokerCommissionBps: response.brokerCommissionBps,
|
|
2587
|
+
boostFeeBps: Number(response.boostFeeBps) || 0,
|
|
2586
2588
|
depositChannelExpiryBlock: response.srcChainExpiryBlock,
|
|
2587
2589
|
estimatedDepositChannelExpiryTime: response.estimatedExpiryTime
|
|
2588
2590
|
};
|