@hyperbridge/sdk 2.7.2 → 2.8.0
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/browser/index.d.ts +463 -405
- package/dist/browser/index.js +67 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +67 -6
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +67 -8
- package/dist/node/index.js.map +1 -1
- package/dist/node/{IntentGatewayV2-MxUcNZNs.d.cts → intents-helpers-gyGREuyu.d.cts} +1868 -235
- package/dist/node/{IntentGatewayV2-MxUcNZNs.d.ts → intents-helpers-gyGREuyu.d.ts} +1868 -235
- package/dist/node/intents-helpers.cjs +113 -19
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +3 -1506
- package/dist/node/intents-helpers.d.ts +3 -1506
- package/dist/node/intents-helpers.js +111 -21
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -4852,6 +4852,24 @@ var ABI3 = [
|
|
|
4852
4852
|
internalType: "uint256"
|
|
4853
4853
|
}
|
|
4854
4854
|
]
|
|
4855
|
+
},
|
|
4856
|
+
{
|
|
4857
|
+
name: "predispatchCall",
|
|
4858
|
+
type: "bytes",
|
|
4859
|
+
indexed: false,
|
|
4860
|
+
internalType: "bytes"
|
|
4861
|
+
},
|
|
4862
|
+
{
|
|
4863
|
+
name: "outputCall",
|
|
4864
|
+
type: "bytes",
|
|
4865
|
+
indexed: false,
|
|
4866
|
+
internalType: "bytes"
|
|
4867
|
+
},
|
|
4868
|
+
{
|
|
4869
|
+
name: "graffiti",
|
|
4870
|
+
type: "bytes32",
|
|
4871
|
+
indexed: false,
|
|
4872
|
+
internalType: "bytes32"
|
|
4855
4873
|
}
|
|
4856
4874
|
],
|
|
4857
4875
|
anonymous: false
|
|
@@ -8233,14 +8251,17 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
|
|
|
8233
8251
|
const orders = [];
|
|
8234
8252
|
for (const { event } of records) {
|
|
8235
8253
|
if (event.section !== "intentsCoprocessor" || event.method !== "PhantomOrderRegistered") continue;
|
|
8236
|
-
const [commitment, chain, createdAt,
|
|
8254
|
+
const [commitment, chain, createdAt, legs] = event.data;
|
|
8237
8255
|
orders.push({
|
|
8238
8256
|
commitment: commitment.toHex(),
|
|
8239
8257
|
chain: new TextDecoder().decode(util.hexToU8a(chain.toHex())),
|
|
8240
8258
|
createdAt: createdAt.toNumber(),
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8259
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8260
|
+
legs: legs.map((leg) => ({
|
|
8261
|
+
tokenA: leg.tokenA.toHex(),
|
|
8262
|
+
tokenB: leg.tokenB.toHex(),
|
|
8263
|
+
standardAmount: BigInt(leg.standardAmount.toString())
|
|
8264
|
+
}))
|
|
8244
8265
|
});
|
|
8245
8266
|
}
|
|
8246
8267
|
return orders;
|
|
@@ -15536,13 +15557,13 @@ function deriveCanonicalPlacedOrder(order, args) {
|
|
|
15536
15557
|
session: args.session,
|
|
15537
15558
|
predispatch: {
|
|
15538
15559
|
assets: args.predispatch.map((asset) => ({ ...asset })),
|
|
15539
|
-
call: order.predispatch.call
|
|
15560
|
+
call: args.predispatchCall ?? order.predispatch.call
|
|
15540
15561
|
},
|
|
15541
15562
|
inputs: args.inputs.map((asset) => ({ ...asset })),
|
|
15542
15563
|
output: {
|
|
15543
15564
|
beneficiary: args.beneficiary,
|
|
15544
15565
|
assets: args.outputs.map((asset) => ({ ...asset })),
|
|
15545
|
-
call: order.output.call
|
|
15566
|
+
call: args.outputCall ?? order.output.call
|
|
15546
15567
|
}
|
|
15547
15568
|
};
|
|
15548
15569
|
return { ...canonicalOrder, id: orderCommitment(canonicalOrder) };
|
|
@@ -19120,6 +19141,44 @@ var IntentGateway = class _IntentGateway {
|
|
|
19120
19141
|
}
|
|
19121
19142
|
}
|
|
19122
19143
|
};
|
|
19144
|
+
var FILL_ORDER_ABI = IntentGatewayV2_default.ABI;
|
|
19145
|
+
var DECLARATION_VERSION = 1;
|
|
19146
|
+
var MAX_DECLARED_CHAINS = 255;
|
|
19147
|
+
function encodeAcceptedSourceChains(chains2) {
|
|
19148
|
+
if (chains2.length > MAX_DECLARED_CHAINS) {
|
|
19149
|
+
throw new Error(`Cannot declare more than ${MAX_DECLARED_CHAINS} source chains`);
|
|
19150
|
+
}
|
|
19151
|
+
const bytes = [DECLARATION_VERSION, chains2.length];
|
|
19152
|
+
for (const chain of chains2) {
|
|
19153
|
+
const encoded = util.stringToU8a(chain);
|
|
19154
|
+
if (encoded.length === 0 || encoded.length > 255) {
|
|
19155
|
+
throw new Error(`Invalid state machine id in source chain declaration: ${chain}`);
|
|
19156
|
+
}
|
|
19157
|
+
bytes.push(encoded.length, ...encoded);
|
|
19158
|
+
}
|
|
19159
|
+
return util.u8aToHex(new Uint8Array(bytes));
|
|
19160
|
+
}
|
|
19161
|
+
function decodeAcceptedSourceChains(paymasterAndData) {
|
|
19162
|
+
if (!paymasterAndData || !util.isHex(paymasterAndData)) return null;
|
|
19163
|
+
const bytes = util.hexToU8a(paymasterAndData);
|
|
19164
|
+
if (bytes.length < 2 || bytes[0] !== DECLARATION_VERSION) return null;
|
|
19165
|
+
const count = bytes[1];
|
|
19166
|
+
const chains2 = [];
|
|
19167
|
+
let offset = 2;
|
|
19168
|
+
for (let entry = 0; entry < count; entry++) {
|
|
19169
|
+
if (offset >= bytes.length) return null;
|
|
19170
|
+
const length = bytes[offset];
|
|
19171
|
+
offset += 1;
|
|
19172
|
+
if (length === 0 || offset + length > bytes.length) return null;
|
|
19173
|
+
chains2.push(util.u8aToString(bytes.subarray(offset, offset + length)));
|
|
19174
|
+
offset += length;
|
|
19175
|
+
}
|
|
19176
|
+
if (offset !== bytes.length) return null;
|
|
19177
|
+
return chains2;
|
|
19178
|
+
}
|
|
19179
|
+
FILL_ORDER_ABI.find(
|
|
19180
|
+
(item) => item?.type === "function" && item?.name === "fillOrder"
|
|
19181
|
+
)?.inputs?.[0];
|
|
19123
19182
|
var TokenGateway = class {
|
|
19124
19183
|
source;
|
|
19125
19184
|
dest;
|
|
@@ -23659,8 +23718,10 @@ exports.convertStateMachineEnumToString = convertStateMachineEnumToString;
|
|
|
23659
23718
|
exports.convertStateMachineIdToEnum = convertStateMachineIdToEnum;
|
|
23660
23719
|
exports.createEvmChain = createEvmChain;
|
|
23661
23720
|
exports.createQueryClient = createQueryClient;
|
|
23721
|
+
exports.decodeAcceptedSourceChains = decodeAcceptedSourceChains;
|
|
23662
23722
|
exports.decodeERC7821ExecuteBatch = decodeERC7821ExecuteBatch;
|
|
23663
23723
|
exports.decodeUserOpScale = decodeUserOpScale;
|
|
23724
|
+
exports.encodeAcceptedSourceChains = encodeAcceptedSourceChains;
|
|
23664
23725
|
exports.encodeERC7821ExecuteBatch = encodeERC7821ExecuteBatch;
|
|
23665
23726
|
exports.encodeISMPMessage = encodeISMPMessage;
|
|
23666
23727
|
exports.encodeStateMachineId = encodeStateMachineId;
|