@nibgate/sdk 0.2.16 → 0.2.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nibgate/sdk",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Framework-agnostic browser and server package for creator-owned gated content, unlock events, and receipts.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -122,7 +122,23 @@ export function createEvmGatewayUnlock(resource, options = {}) {
122
122
  network,
123
123
  signer: {
124
124
  address: currentAddress,
125
- signTypedData: (typedData) => evm.request({ method: 'eth_signTypedData_v4', params: [currentAddress, stringifyJson(typedData)] })
125
+ signTypedData: (typedData) => {
126
+ // Some MetaMask versions require EIP712Domain to be explicitly
127
+ // present in the types object for correct hash computation.
128
+ const enriched = {
129
+ ...typedData,
130
+ types: {
131
+ EIP712Domain: [
132
+ { name: 'name', type: 'string' },
133
+ { name: 'version', type: 'string' },
134
+ { name: 'chainId', type: 'uint256' },
135
+ { name: 'verifyingContract', type: 'address' }
136
+ ],
137
+ ...typedData.types
138
+ }
139
+ };
140
+ return evm.request({ method: 'eth_signTypedData_v4', params: [currentAddress, stringifyJson(enriched)] });
141
+ }
126
142
  },
127
143
  clientModule: options.circleClientModule
128
144
  });