four-flap-meme-sdk 1.7.9 → 1.7.10

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.
@@ -34,11 +34,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
34
34
  async function signAuthorization(wallet, nonce) {
35
35
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
36
36
  const signature = wallet.signingKey.sign(messageHash);
37
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
37
38
  return {
38
39
  chainId: XLAYER_CHAIN_ID,
39
40
  address: EXECUTOR_ADDRESS,
40
41
  nonce,
41
- v: signature.v,
42
+ v: signature.yParity,
42
43
  r: signature.r,
43
44
  s: signature.s,
44
45
  };
@@ -207,10 +208,10 @@ export class XLayerBundle {
207
208
  ]);
208
209
  const txHash = ethers.keccak256(unsigned);
209
210
  const signature = sponsor.signingKey.sign(txHash);
210
- // 添加签名
211
+ // 添加签名(注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28))
211
212
  const signedFields = [
212
213
  ...fields,
213
- toRlpHex(signature.v),
214
+ toRlpHex(signature.yParity),
214
215
  signature.r,
215
216
  signature.s,
216
217
  ];
@@ -68,11 +68,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
68
68
  function signAuthorization(wallet, nonce = 0) {
69
69
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
70
70
  const signature = wallet.signingKey.sign(messageHash);
71
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
71
72
  return {
72
73
  chainId: XLAYER_CHAIN_ID,
73
74
  address: EXECUTOR_ADDRESS,
74
75
  nonce,
75
- v: signature.v,
76
+ v: signature.yParity,
76
77
  r: signature.r,
77
78
  s: signature.s,
78
79
  };
@@ -269,7 +270,8 @@ async function buildAndSignType4Transaction(rpcUrl, gasPrice, participants) {
269
270
  const unsigned = ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(fields)]);
270
271
  const txHashToSign = ethers.keccak256(unsigned);
271
272
  const signature = sponsor.signingKey.sign(txHashToSign);
272
- const signedFields = [...fields, toRlpHex(signature.v), signature.r, signature.s];
273
+ // 注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28)
274
+ const signedFields = [...fields, toRlpHex(signature.yParity), signature.r, signature.s];
273
275
  const signedTx = ethers.hexlify(ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(signedFields)]));
274
276
  const txHash = ethers.keccak256(signedTx);
275
277
  return { signedTx, txHash, sponsorAddress: sponsor.address };
@@ -64,11 +64,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
64
64
  function signAuthorization(wallet, nonce = 0) {
65
65
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
66
66
  const signature = wallet.signingKey.sign(messageHash);
67
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
67
68
  return {
68
69
  chainId: XLAYER_CHAIN_ID,
69
70
  address: EXECUTOR_ADDRESS,
70
71
  nonce,
71
- v: signature.v,
72
+ v: signature.yParity,
72
73
  r: signature.r,
73
74
  s: signature.s,
74
75
  };
@@ -204,7 +205,8 @@ async function buildAndSignType4Transaction(rpcUrl, gasPrice, participants) {
204
205
  const unsigned = ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(fields)]);
205
206
  const txHashToSign = ethers.keccak256(unsigned);
206
207
  const signature = sponsor.signingKey.sign(txHashToSign);
207
- const signedFields = [...fields, toRlpHex(signature.v), signature.r, signature.s];
208
+ // 注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28)
209
+ const signedFields = [...fields, toRlpHex(signature.yParity), signature.r, signature.s];
208
210
  const signedTx = ethers.hexlify(ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(signedFields)]));
209
211
  const txHash = ethers.keccak256(signedTx);
210
212
  return { signedTx, txHash, sponsorAddress: sponsor.address };
@@ -54,11 +54,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
54
54
  function signAuthorization(wallet, nonce = 0) {
55
55
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
56
56
  const signature = wallet.signingKey.sign(messageHash);
57
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
57
58
  return {
58
59
  chainId: XLAYER_CHAIN_ID,
59
60
  address: EXECUTOR_ADDRESS,
60
61
  nonce,
61
- v: signature.v,
62
+ v: signature.yParity,
62
63
  r: signature.r,
63
64
  s: signature.s,
64
65
  };
@@ -141,7 +142,8 @@ async function buildAndSignType4Transaction(config, participants) {
141
142
  const unsigned = ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(fields)]);
142
143
  const txHashToSign = ethers.keccak256(unsigned);
143
144
  const signature = sponsor.signingKey.sign(txHashToSign);
144
- const signedFields = [...fields, toRlpHex(signature.v), signature.r, signature.s];
145
+ // 注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28)
146
+ const signedFields = [...fields, toRlpHex(signature.yParity), signature.r, signature.s];
145
147
  const signedTx = ethers.hexlify(ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(signedFields)]));
146
148
  const txHash = ethers.keccak256(signedTx);
147
149
  return { signedTx, txHash, sponsorAddress: sponsor.address };
@@ -124,11 +124,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
124
124
  function signAuthorization(wallet, nonce = 0) {
125
125
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
126
126
  const signature = wallet.signingKey.sign(messageHash);
127
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
127
128
  return {
128
129
  chainId: XLAYER_CHAIN_ID,
129
130
  address: EXECUTOR_ADDRESS,
130
131
  nonce,
131
- v: signature.v,
132
+ v: signature.yParity,
132
133
  r: signature.r,
133
134
  s: signature.s,
134
135
  };
@@ -220,9 +221,10 @@ async function buildAndSignType4Transaction(config, participants) {
220
221
  ]);
221
222
  const txHashToSign = ethers.keccak256(unsigned);
222
223
  const signature = sponsor.signingKey.sign(txHashToSign);
224
+ // 注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28)
223
225
  const signedFields = [
224
226
  ...fields,
225
- toRlpHex(signature.v),
227
+ toRlpHex(signature.yParity),
226
228
  signature.r,
227
229
  signature.s,
228
230
  ];
@@ -54,11 +54,12 @@ function hashAuthorization(chainId, executorAddress, nonce) {
54
54
  function signAuthorization(wallet, nonce = 0) {
55
55
  const messageHash = hashAuthorization(XLAYER_CHAIN_ID, EXECUTOR_ADDRESS, nonce);
56
56
  const signature = wallet.signingKey.sign(messageHash);
57
+ // 注意:EIP-7702 授权签名使用 yParity (0 或 1),不是 v (27 或 28)
57
58
  return {
58
59
  chainId: XLAYER_CHAIN_ID,
59
60
  address: EXECUTOR_ADDRESS,
60
61
  nonce,
61
- v: signature.v,
62
+ v: signature.yParity,
62
63
  r: signature.r,
63
64
  s: signature.s,
64
65
  };
@@ -137,7 +138,8 @@ async function buildAndSignType4Transaction(config, participants) {
137
138
  const unsigned = ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(fields)]);
138
139
  const txHashToSign = ethers.keccak256(unsigned);
139
140
  const signature = sponsor.signingKey.sign(txHashToSign);
140
- const signedFields = [...fields, toRlpHex(signature.v), signature.r, signature.s];
141
+ // 注意:Type 4 交易使用 yParity (0 或 1),不是 v (27 或 28)
142
+ const signedFields = [...fields, toRlpHex(signature.yParity), signature.r, signature.s];
141
143
  const signedTx = ethers.hexlify(ethers.concat([new Uint8Array([0x04]), ethers.encodeRlp(signedFields)]));
142
144
  const txHash = ethers.keccak256(signedTx);
143
145
  return { signedTx, txHash, sponsorAddress: sponsor.address };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",