Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pretty-dolphins-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/sdk": patch
---

added domainSeparatorVersion SDK Options for relayers
6 changes: 4 additions & 2 deletions packages/sdk/src/evm/common/permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export async function signDAIPermit(
allowed = true,
deadline?: BigNumberish,
nonce?: BigNumberish,
domainSeparatorVersion?: string,
) {
const [name, chainId, signerNonce] = await Promise.all([
getTokenName(signer, currencyAddress),
Expand All @@ -138,7 +139,7 @@ export async function signDAIPermit(
]);
const domain = await getChainDomainSeperator(signer, {
name,
version: "1",
version: domainSeparatorVersion || "1",
chainId,
verifyingContract: currencyAddress,
});
Expand Down Expand Up @@ -190,6 +191,7 @@ export async function signEIP2612Permit(
value: BigNumberish,
deadline?: BigNumberish,
nonce?: BigNumberish,
domainSeparatorVersion?: string,
) {
const [name, chainId, signerNonce] = await Promise.all([
getTokenName(signer, currencyAddress),
Expand All @@ -198,7 +200,7 @@ export async function signEIP2612Permit(
]);
const domain = await getChainDomainSeperator(signer, {
name,
version: "1",
version: domainSeparatorVersion || "1",
chainId,
verifyingContract: currencyAddress,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ export class ContractWrapper<
transaction.from,
spender,
amount,
this.options.gasless.engine.domainSeparatorVersion,
);

const message = {
Expand Down Expand Up @@ -1099,6 +1100,7 @@ export class ContractWrapper<
transaction.from,
spender,
amount,
this.options.gasless.openzeppelin.domainSeparatorVersion,
);

const { r, s, v } = utils.splitSignature(sig);
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/evm/core/classes/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,7 @@ async function enginePrepareRequest(
transaction.from,
spender,
amount,
gaslessOptions.engine.domainSeparatorVersion,
);

const message = {
Expand Down Expand Up @@ -1295,6 +1296,7 @@ async function defenderPrepareRequest(
transaction.from,
spender,
amount,
gaslessOptions.openzeppelin.domainSeparatorVersion,
);

const { r, s, v } = utils.splitSignature(sig);
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/evm/schema/sdk-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const SDKOptionsSchema = /* @__PURE__ */ (() =>
useEOAForwarder: z.boolean().default(false),
domainName: z.string().default("GSNv2 Forwarder"),
domainVersion: z.string().default("0.0.1"),
domainSeparatorVersion: z.string().default("1"),
}),
experimentalChainlessSupport: z.boolean().default(false),
}),
Expand All @@ -58,6 +59,7 @@ export const SDKOptionsSchema = /* @__PURE__ */ (() =>
relayerForwarderAddress: z.string().optional(),
domainName: z.string().default("GSNv2 Forwarder"),
domainVersion: z.string().default("0.0.1"),
domainSeparatorVersion: z.string().default("1"),
}),
experimentalChainlessSupport: z.boolean().default(false),
}),
Expand Down