@reyaxyz/sdk 0.33.0 → 0.34.1
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/services/executeTransaction.js +4 -2
- package/dist/services/executeTransaction.js.map +1 -1
- package/dist/types/services/executeTransaction.d.ts +2 -0
- package/dist/types/services/executeTransaction.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/services/executeTransaction.ts +10 -2
|
@@ -51,7 +51,7 @@ exports.executeTransaction = exports.estimateGas = void 0;
|
|
|
51
51
|
var contractAddresses_1 = require("../utils/contractAddresses");
|
|
52
52
|
function estimateGas(signer, data, value, chainId, targetContract) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var accountAddress, contractAddress, tx, gasLimit;
|
|
54
|
+
var accountAddress, contractAddress, tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas;
|
|
55
55
|
return __generator(this, function (_a) {
|
|
56
56
|
switch (_a.label) {
|
|
57
57
|
case 0: return [4 /*yield*/, signer.getAddress()];
|
|
@@ -62,7 +62,9 @@ function estimateGas(signer, data, value, chainId, targetContract) {
|
|
|
62
62
|
: targetContract;
|
|
63
63
|
tx = __assign({ from: accountAddress, to: contractAddress, data: data }, (value && value !== '0' ? { value: value } : {}));
|
|
64
64
|
gasLimit = BigInt('5000000');
|
|
65
|
-
|
|
65
|
+
maxPriorityFeePerGas = BigInt('0');
|
|
66
|
+
maxFeePerGas = BigInt('0');
|
|
67
|
+
return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit, maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas })];
|
|
66
68
|
}
|
|
67
69
|
});
|
|
68
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AAc,CACf,EAAA;;oBANK,MAAM,GAAG,SAMd;;;;oBAGoB,qBAAM,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,EAAA;;oBAAjD,UAAU,GAAG,SAAoC;oBACrC,qBAAM,UAAU,CAAC,IAAI,EAAE,EAAA;;oBAAnC,SAAS,GAAG,SAAuB;oBACzC,sBAAO,SAAS,EAAC;;;oBAEjB,OAAO,CAAC,IAAI,CAAC,OAAK,CAAC,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;;CAElD;AAvBD,gDAuBC","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { ContractType, getAddress } from '../utils/contractAddresses';\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas: bigint;\n maxFeePerGas: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('0');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGas(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\n"]}
|
|
@@ -8,6 +8,8 @@ export type Transaction = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function estimateGas(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
|
|
10
10
|
gasLimit: bigint;
|
|
11
|
+
maxPriorityFeePerGas: bigint;
|
|
12
|
+
maxFeePerGas: bigint;
|
|
11
13
|
}>;
|
|
12
14
|
export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
|
|
13
15
|
//# sourceMappingURL=executeTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,CACR,WAAW,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAkBA;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,uDAkBtC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@reyaxyz/common": "0.
|
|
32
|
+
"@reyaxyz/common": "0.45.0",
|
|
33
33
|
"bignumber.js": "^9.1.2",
|
|
34
34
|
"ethers": "6.9.0"
|
|
35
35
|
},
|
|
36
36
|
"packageManager": "pnpm@8.10.4",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "450faab59074149c97db18a8d3330b5e1a9c73d7"
|
|
38
38
|
}
|
|
@@ -14,7 +14,13 @@ export async function estimateGas(
|
|
|
14
14
|
value: string,
|
|
15
15
|
chainId: number,
|
|
16
16
|
targetContract: ContractType | string,
|
|
17
|
-
): Promise<
|
|
17
|
+
): Promise<
|
|
18
|
+
Transaction & {
|
|
19
|
+
gasLimit: bigint;
|
|
20
|
+
maxPriorityFeePerGas: bigint;
|
|
21
|
+
maxFeePerGas: bigint;
|
|
22
|
+
}
|
|
23
|
+
> {
|
|
18
24
|
const accountAddress = await signer.getAddress();
|
|
19
25
|
const contractAddress = Object.values(ContractType).includes(
|
|
20
26
|
targetContract as ContractType,
|
|
@@ -29,7 +35,9 @@ export async function estimateGas(
|
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit
|
|
32
|
-
|
|
38
|
+
const maxPriorityFeePerGas: bigint = BigInt('0');
|
|
39
|
+
const maxFeePerGas: bigint = BigInt('0');
|
|
40
|
+
return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
export async function executeTransaction(
|