@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z, __name, Assets,
|
|
1
|
+
import { ccmMetadataSchema } from './chunk-TKSJD3PK.mjs';
|
|
2
|
+
import { z, __name, Assets, chainflipAssetAndChain, numericString, hexString, btcAddress, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-XMGPLWGR.mjs';
|
|
3
3
|
import { u8aToHex } from '@polkadot/util';
|
|
4
4
|
import { decodeAddress } from '@polkadot/util-crypto';
|
|
5
5
|
import axios from 'axios';
|
|
@@ -53,14 +53,16 @@ var requestValidators = /* @__PURE__ */ __name((network) => ({
|
|
|
53
53
|
hexString,
|
|
54
54
|
z.string()
|
|
55
55
|
]).optional()
|
|
56
|
-
})).optional()
|
|
57
|
-
|
|
56
|
+
})).optional(),
|
|
57
|
+
z.number().optional()
|
|
58
|
+
]).transform(([a, b, c, d, e, f]) => [
|
|
58
59
|
a,
|
|
59
60
|
b,
|
|
60
61
|
c,
|
|
61
62
|
d,
|
|
62
|
-
transformObjToSnakeCase(e)
|
|
63
|
-
|
|
63
|
+
transformObjToSnakeCase(e),
|
|
64
|
+
f
|
|
65
|
+
])
|
|
64
66
|
}), "requestValidators");
|
|
65
67
|
var responseValidators = /* @__PURE__ */ __name((network) => ({
|
|
66
68
|
requestSwapDepositAddress: z.object({
|
|
@@ -94,7 +96,7 @@ var makeRpcRequest = /* @__PURE__ */ __name(async (network, url, method, ...para
|
|
|
94
96
|
return responseValidators(network)[method].parse(result.result);
|
|
95
97
|
}, "makeRpcRequest");
|
|
96
98
|
async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork) {
|
|
97
|
-
const { srcAsset, srcChain, destAsset, destChain, destAddress } = swapRequest;
|
|
99
|
+
const { srcAsset, srcChain, destAsset, destChain, destAddress, boostFeeBps } = swapRequest;
|
|
98
100
|
return makeRpcRequest(chainflipNetwork, opts.url, "requestSwapDepositAddress", {
|
|
99
101
|
asset: srcAsset,
|
|
100
102
|
chain: srcChain
|
|
@@ -104,7 +106,7 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork) {
|
|
|
104
106
|
}, submitAddress(destAsset, destAddress), opts.commissionBps, swapRequest.ccmMetadata && {
|
|
105
107
|
...swapRequest.ccmMetadata,
|
|
106
108
|
cfParameters: void 0
|
|
107
|
-
});
|
|
109
|
+
}, boostFeeBps);
|
|
108
110
|
}
|
|
109
111
|
__name(requestSwapDepositAddress, "requestSwapDepositAddress");
|
|
110
112
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z, chainflipAssetAndChain, numericString, hexStringWithMaxByteSize, chainflipAsset, chainflipChain } from './chunk-XMGPLWGR.mjs';
|
|
2
|
+
|
|
3
|
+
// ../shared/src/schemas.ts
|
|
4
|
+
z.object({
|
|
5
|
+
srcAsset: chainflipAssetAndChain,
|
|
6
|
+
destAsset: chainflipAssetAndChain,
|
|
7
|
+
amount: numericString,
|
|
8
|
+
brokerCommissionBps: z.string().regex(/^[0-9]*$/).transform((v) => Number(v)).optional()
|
|
9
|
+
});
|
|
10
|
+
var ccmMetadataSchema = z.object({
|
|
11
|
+
gasBudget: numericString,
|
|
12
|
+
message: hexStringWithMaxByteSize(1024 * 10)
|
|
13
|
+
});
|
|
14
|
+
z.object({
|
|
15
|
+
srcAsset: chainflipAsset,
|
|
16
|
+
destAsset: chainflipAsset,
|
|
17
|
+
srcChain: chainflipChain,
|
|
18
|
+
destChain: chainflipChain,
|
|
19
|
+
destAddress: z.string(),
|
|
20
|
+
amount: numericString,
|
|
21
|
+
ccmMetadata: ccmMetadataSchema.optional(),
|
|
22
|
+
boostFeeBps: z.number().optional()
|
|
23
|
+
}).transform(({ amount, ...rest }) => ({
|
|
24
|
+
...rest,
|
|
25
|
+
expectedDepositAmount: amount
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export { ccmMetadataSchema };
|