@defuse-protocol/intents-sdk 0.29.1 → 0.29.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.
|
@@ -20,7 +20,7 @@ var IntentExecuter = class {
|
|
|
20
20
|
verifying_contract: verifyingContract,
|
|
21
21
|
...intentParams
|
|
22
22
|
});
|
|
23
|
-
if (this.intentPayloadFactory) intentPayload = await mergeIntentPayloads(intentPayload, this.intentPayloadFactory);
|
|
23
|
+
if (this.intentPayloadFactory) intentPayload = await mergeIntentPayloads(intentPayload, this.intentPayloadFactory, salt);
|
|
24
24
|
const multiPayload = await this.intentSigner.signIntent(intentPayload);
|
|
25
25
|
const relayParams = relayParamsFactory ? await relayParamsFactory() : {};
|
|
26
26
|
if (this.onBeforePublishIntent) {
|
|
@@ -49,14 +49,15 @@ var IntentExecuter = class {
|
|
|
49
49
|
return this.intentRelayer.waitForSettlement(ticket, { logger: this.logger });
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
async function mergeIntentPayloads(
|
|
53
|
-
const customPayload = await intentPayloadFactory(
|
|
52
|
+
async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
|
|
53
|
+
const customPayload = await intentPayloadFactory(defaultPayload);
|
|
54
54
|
const customPayloadIntents = customPayload.intents ?? [];
|
|
55
|
-
|
|
55
|
+
const { nonce: _nonce,...basePayload } = defaultPayload;
|
|
56
|
+
return require_intent_payload_factory.defaultIntentPayloadFactory(salt, {
|
|
56
57
|
...basePayload,
|
|
57
58
|
...customPayload,
|
|
58
59
|
intents: Array.from(new Set([...customPayloadIntents, ...basePayload.intents]))
|
|
59
|
-
};
|
|
60
|
+
});
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Composes a new MultiPayload with pre-signed intents for atomic execution.
|
|
@@ -18,7 +18,7 @@ var IntentExecuter = class {
|
|
|
18
18
|
verifying_contract: verifyingContract,
|
|
19
19
|
...intentParams
|
|
20
20
|
});
|
|
21
|
-
if (this.intentPayloadFactory) intentPayload = await mergeIntentPayloads(intentPayload, this.intentPayloadFactory);
|
|
21
|
+
if (this.intentPayloadFactory) intentPayload = await mergeIntentPayloads(intentPayload, this.intentPayloadFactory, salt);
|
|
22
22
|
const multiPayload = await this.intentSigner.signIntent(intentPayload);
|
|
23
23
|
const relayParams = relayParamsFactory ? await relayParamsFactory() : {};
|
|
24
24
|
if (this.onBeforePublishIntent) {
|
|
@@ -47,14 +47,15 @@ var IntentExecuter = class {
|
|
|
47
47
|
return this.intentRelayer.waitForSettlement(ticket, { logger: this.logger });
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
async function mergeIntentPayloads(
|
|
51
|
-
const customPayload = await intentPayloadFactory(
|
|
50
|
+
async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
|
|
51
|
+
const customPayload = await intentPayloadFactory(defaultPayload);
|
|
52
52
|
const customPayloadIntents = customPayload.intents ?? [];
|
|
53
|
-
|
|
53
|
+
const { nonce: _nonce,...basePayload } = defaultPayload;
|
|
54
|
+
return defaultIntentPayloadFactory(salt, {
|
|
54
55
|
...basePayload,
|
|
55
56
|
...customPayload,
|
|
56
57
|
intents: Array.from(new Set([...customPayloadIntents, ...basePayload.intents]))
|
|
57
|
-
};
|
|
58
|
+
});
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
61
|
* Composes a new MultiPayload with pre-signed intents for atomic execution.
|
|
@@ -4,7 +4,7 @@ const require_expirable_nonce = require('./expirable-nonce.cjs');
|
|
|
4
4
|
const DEFAULT_DEADLINE_MS = 60 * 1e3;
|
|
5
5
|
function defaultIntentPayloadFactory(salt, { intents, verifying_contract,...params }) {
|
|
6
6
|
params = Object.fromEntries(Object.entries(params).filter(([, value]) => value !== void 0));
|
|
7
|
-
const deadline = new Date(Date.now() + DEFAULT_DEADLINE_MS);
|
|
7
|
+
const deadline = params.deadline != null ? new Date(params.deadline) : new Date(Date.now() + DEFAULT_DEADLINE_MS);
|
|
8
8
|
return {
|
|
9
9
|
verifying_contract,
|
|
10
10
|
deadline: deadline.toISOString(),
|
|
@@ -4,7 +4,7 @@ import { VersionedNonceBuilder } from "./expirable-nonce.js";
|
|
|
4
4
|
const DEFAULT_DEADLINE_MS = 60 * 1e3;
|
|
5
5
|
function defaultIntentPayloadFactory(salt, { intents, verifying_contract,...params }) {
|
|
6
6
|
params = Object.fromEntries(Object.entries(params).filter(([, value]) => value !== void 0));
|
|
7
|
-
const deadline = new Date(Date.now() + DEFAULT_DEADLINE_MS);
|
|
7
|
+
const deadline = params.deadline != null ? new Date(params.deadline) : new Date(Date.now() + DEFAULT_DEADLINE_MS);
|
|
8
8
|
return {
|
|
9
9
|
verifying_contract,
|
|
10
10
|
deadline: deadline.toISOString(),
|