@chainflip/sdk 0.2.18 → 0.2.19

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.
@@ -1,4 +1,4 @@
1
- import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-2HHAR3ZI.mjs';
1
+ import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-Z7GY2ZBQ.mjs';
2
2
  import { z, isNotNullish, __name, Assets } from './chunk-6B4B7WKD.mjs';
3
3
  import { u8aToHex } from '@polkadot/util';
4
4
  import { decodeAddress } from '@polkadot/util-crypto';
@@ -253,6 +253,9 @@ z.number({
253
253
  });
254
254
  var numericString = string.regex(/^[0-9]+$/);
255
255
  var hexString = z.custom((val) => typeof val === "string" && /^0x[0-9a-f]+$/i.test(val));
256
+ var hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString.refine((val) => val.length / 2 <= maxByteSize + 1, {
257
+ message: `String must be less than or equal to ${maxByteSize} bytes`
258
+ }), "hexStringWithMaxByteSize");
256
259
  var hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
257
260
  string.regex(/^[0-9a-f]+$/);
258
261
  var btcAddress = /* @__PURE__ */ __name((env) => {
@@ -350,7 +353,7 @@ z.object({
350
353
  });
351
354
  var ccmMetadataSchema = z.object({
352
355
  gasBudget: numericString,
353
- message: hexString
356
+ message: hexStringWithMaxByteSize(1024 * 10)
354
357
  });
355
358
  z.object({
356
359
  srcAsset: chainflipAsset,
package/dist/swap.d.mts CHANGED
@@ -97,7 +97,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
97
97
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
98
98
  ccmMetadata: z.ZodObject<{
99
99
  gasBudget: z.ZodString;
100
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
100
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
101
101
  }, "strip", z.ZodTypeAny, {
102
102
  message: `0x${string}`;
103
103
  gasBudget: string;
@@ -136,7 +136,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
136
136
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
137
137
  ccmMetadata: z.ZodObject<{
138
138
  gasBudget: z.ZodString;
139
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
139
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
140
140
  }, "strip", z.ZodTypeAny, {
141
141
  message: `0x${string}`;
142
142
  gasBudget: string;
@@ -175,7 +175,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
175
175
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
176
176
  ccmMetadata: z.ZodObject<{
177
177
  gasBudget: z.ZodString;
178
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
178
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
179
179
  }, "strip", z.ZodTypeAny, {
180
180
  message: `0x${string}`;
181
181
  gasBudget: string;
@@ -358,7 +358,7 @@ type TokenSwapParams = z.infer<typeof tokenSwapParamsSchema>;
358
358
 
359
359
  declare const ccmMetadataSchema: z.ZodObject<{
360
360
  gasBudget: z.ZodString;
361
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
361
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
362
362
  }, "strip", z.ZodTypeAny, {
363
363
  message: `0x${string}`;
364
364
  gasBudget: string;
package/dist/swap.d.ts CHANGED
@@ -97,7 +97,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
97
97
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
98
98
  ccmMetadata: z.ZodObject<{
99
99
  gasBudget: z.ZodString;
100
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
100
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
101
101
  }, "strip", z.ZodTypeAny, {
102
102
  message: `0x${string}`;
103
103
  gasBudget: string;
@@ -136,7 +136,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
136
136
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
137
137
  ccmMetadata: z.ZodObject<{
138
138
  gasBudget: z.ZodString;
139
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
139
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
140
140
  }, "strip", z.ZodTypeAny, {
141
141
  message: `0x${string}`;
142
142
  gasBudget: string;
@@ -175,7 +175,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
175
175
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
176
176
  ccmMetadata: z.ZodObject<{
177
177
  gasBudget: z.ZodString;
178
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
178
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
179
179
  }, "strip", z.ZodTypeAny, {
180
180
  message: `0x${string}`;
181
181
  gasBudget: string;
@@ -358,7 +358,7 @@ type TokenSwapParams = z.infer<typeof tokenSwapParamsSchema>;
358
358
 
359
359
  declare const ccmMetadataSchema: z.ZodObject<{
360
360
  gasBudget: z.ZodString;
361
- message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
361
+ message: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
362
362
  }, "strip", z.ZodTypeAny, {
363
363
  message: `0x${string}`;
364
364
  gasBudget: string;
package/dist/swap.js CHANGED
@@ -4211,7 +4211,7 @@ var init_addressValidation = __esm({
4211
4211
  validateBitcoinRegtestAddress = /* @__PURE__ */ __name((address) => validateBitcoinAddress(address, "regtest"), "validateBitcoinRegtestAddress");
4212
4212
  }
4213
4213
  });
4214
- var safeStringify, errorMap2, string, numericString, hexString, hexStringFromNumber, btcAddress, dotAddress, ethereumAddress, u128, unsignedInteger, transformAsset, chainflipChain, chainflipAsset, chainflipAssetAndChain;
4214
+ var safeStringify, errorMap2, string, numericString, hexString, hexStringWithMaxByteSize, hexStringFromNumber, btcAddress, dotAddress, ethereumAddress, u128, unsignedInteger, transformAsset, chainflipChain, chainflipAsset, chainflipAssetAndChain;
4215
4215
  var init_parsers = __esm({
4216
4216
  "../shared/src/parsers.ts"() {
4217
4217
  init_lib();
@@ -4230,6 +4230,9 @@ var init_parsers = __esm({
4230
4230
  });
4231
4231
  numericString = string.regex(/^[0-9]+$/);
4232
4232
  hexString = z.custom((val) => typeof val === "string" && /^0x[0-9a-f]+$/i.test(val));
4233
+ hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString.refine((val) => val.length / 2 <= maxByteSize + 1, {
4234
+ message: `String must be less than or equal to ${maxByteSize} bytes`
4235
+ }), "hexStringWithMaxByteSize");
4233
4236
  hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
4234
4237
  string.regex(/^[0-9a-f]+$/);
4235
4238
  btcAddress = /* @__PURE__ */ __name((env) => {
@@ -4334,7 +4337,7 @@ var init_schemas = __esm({
4334
4337
  });
4335
4338
  ccmMetadataSchema = z.object({
4336
4339
  gasBudget: numericString,
4337
- message: hexString
4340
+ message: hexStringWithMaxByteSize(1024 * 10)
4338
4341
  });
4339
4342
  z.object({
4340
4343
  srcAsset: chainflipAsset,
package/dist/swap.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-JIK6G4FY.mjs';
2
- import { numericString, ethereumAddress, dotAddress, btcAddress, ccmMetadataSchema } from './chunk-2HHAR3ZI.mjs';
2
+ import { numericString, ethereumAddress, dotAddress, btcAddress, ccmMetadataSchema } from './chunk-Z7GY2ZBQ.mjs';
3
3
  import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-6B4B7WKD.mjs';
4
4
  export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-6B4B7WKD.mjs';
5
5
  import { decodeAddress } from '@polkadot/util-crypto';
@@ -2520,7 +2520,7 @@ var _SwapSDK = class _SwapSDK {
2520
2520
  async requestDepositAddress(depositAddressRequest) {
2521
2521
  let response;
2522
2522
  if (this.brokerConfig !== void 0) {
2523
- const { requestSwapDepositAddress } = await import('./broker-TKLJ3YAQ.mjs');
2523
+ const { requestSwapDepositAddress } = await import('./broker-6S6G34FM.mjs');
2524
2524
  const result = await requestSwapDepositAddress(depositAddressRequest, this.brokerConfig);
2525
2525
  response = {
2526
2526
  id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {