@reyaxyz/sdk 0.55.0 → 0.57.0
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 +1 -1
- package/dist/services/executeTransaction.js.map +1 -1
- package/dist/services/sign.js.map +1 -1
- package/dist/types/services/sign.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/services/executeTransaction.ts +1 -1
- package/src/services/sign.ts +1 -0
|
@@ -81,7 +81,7 @@ function estimateGas(signer, data, value, chainId, targetContract) {
|
|
|
81
81
|
case 5:
|
|
82
82
|
if (Object.values(common_1.ReyaChainId).includes(chainId)) {
|
|
83
83
|
maxPriorityFeePerGas = BigInt('0');
|
|
84
|
-
maxFeePerGas = BigInt('
|
|
84
|
+
maxFeePerGas = BigInt('100000000');
|
|
85
85
|
return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit, maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas })];
|
|
86
86
|
}
|
|
87
87
|
return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit })];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAAsE;AACtE,gDAAkD;AAClD,oCAGmB;AACnB,0CAA8C;AAS9C,SAAsB,WAAW,CAC/B,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;wBAQd,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAE1C,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAY,CAAC,CAAC,QAAQ,CAC1D,cAA8B,CAC/B;wBACC,CAAC,CAAC,IAAA,8BAAU,EAAC,OAAO,EAAE,cAA8B,CAAC;wBACrD,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AAA;;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;AAED,SAAsB,2BAA2B,CAC/C,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC,EACrC,QAAsC;;;;;;oBAEhC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAY,CAAC,CAAC,QAAQ,CAC1D,cAA8B,CAC/B;wBACC,CAAC,CAAC,IAAA,8BAAU,EAAC,OAAO,EAAE,cAA8B,CAAC;wBACrD,CAAC,CAAC,cAAc,CAAC;;;;oBAEX,uBAAuB,GAAG,IAAA,mCAA0B,GAAE,CAAC;oBAE3D,qBAAM,uBAAuB,CAAC,kBAAkB,CAC9C,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,EACnC,eAAe,EACf,QAAQ,CACT,EAAA;;oBALG,KACJ,SAIC,EALK,MAAM,YAAA,EAAE,SAAS,eAAA;oBAMzB,sBAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,WAAA,EAAE,EAAC;;;oBAEnC,OAAO,CAAC,IAAI,CAAC,OAAK,CAAC,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;;CAElD;AA1BD,kEA0BC","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { ContractType, getAddress } from '../utils/contractAddresses';\nimport { getGasBuffer } from '../utils/txHelpers';\nimport {\n BroadcastTransactionMetadata,\n getTransactionModuleClient,\n} from '../config';\nimport { ReyaChainId } from '@reyaxyz/common';\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\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, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n // sentry error & thorw\n console.warn(error);\n throw new Error('Error executing transaction'); // @todo introduce error parsing\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\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\nexport async function signAndBroadcastTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n metadata: BroadcastTransactionMetadata,\n): Promise<{ hash: string; accountId?: string }> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n try {\n const transactionModuleClient = getTransactionModuleClient();\n const { txHash, accountId } =\n await transactionModuleClient.executeTransaction(\n { to: contractAddress, data: data },\n contractAddress,\n metadata,\n );\n return { hash: txHash, accountId };\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"/","sources":["services/sign.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA0E;AAC1E,gEAAsE;AAGtE,iCAAgC;AAShC,SAAS,uCAAuC,CAC9C,SAAoB,EACpB,QAAgB;IAEhB,OAAO;QACL,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC;AAED,SAAsB,gBAAgB,CACpC,MAA8B,EAC9B,WAAwB,EACxB,MAAe,EACf,SAAiB,EACjB,QAAmB,EACnB,KAAa,EACb,QAAgB;;;;;wBAEE,qBAAM,iBAAiB,CACvC,MAAM,EACN,IAAA,8BAAU,EAAC,WAAW,EAAE,gCAAY,CAAC,UAAU,CAAC,EAChD;wBACE,YAAY,EAAE;4BACZ,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE;4BAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;4BACnC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;4BACtC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE;4BACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;4BAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;4BACrC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE;yBAC9C;wBACD,O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zB,KAA4C;AAC5C,8DAA8D;AAC9D,KAA0B;;;;;;oBAEpB,MAAM,GAAG;wBACb,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,GAAG;wBACZ,iBAAiB,EAAE,iBAAiB;qBACrC,CAAC;oBAEsB,qBAAM,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAA;;oBAAlE,eAAe,GAAG,SAAgD;oBAExE,sBAAO,kBAAS,CAAC,IAAI,CAAC,eAAe,CAAC,EAAC;;;;CACxC","sourcesContent":["import { JsonRpcSigner, Signature, Signer, TypedDataField } from 'ethers';\nimport { ContractType, getAddress } from '../utils/contractAddresses';\nimport { Address, ReyaChainId } from '@reyaxyz/common';\nimport { Command } from '../utils/action';\nimport { ethers } from 'ethers';\n\nexport type EIP712Signature = {\n v: number;\n r: string;\n s: string;\n deadline: number;\n};\n\nfunction convertEthersSignatureToEIP712Signature(\n signature: Signature,\n deadline: number,\n): EIP712Signature {\n return {\n v: signature.v,\n r: signature.r,\n s: signature.s,\n deadline: deadline,\n };\n}\n\nexport async function signCoreCommands(\n signer: Signer | JsonRpcSigner,\n reyaChainId: ReyaChainId,\n caller: Address,\n accountId: number,\n commands: Command[],\n nonce: number,\n deadline: number,\n): Promise<EIP712Signature> {\n const signature = await signReyaTypedData(\n signer,\n getAddress(reyaChainId, ContractType.CORE_PROXY),\n {\n ExecuteBySig: [\n { name: 'verifyingChainId', type: 'uint256' },\n { name: 'caller', type: 'address' },\n { name: 'accountId', type: 'uint128' },\n { name: 'commands', type: 'Command[]' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n { name: 'extraSignatureData', type: 'bytes' },\n ],\n Command: [\n { name: 'commandType', type: 'uint8' },\n { name: 'inputs', type: 'bytes' },\n { name: 'marketId', type: 'uint128' },\n { name: 'exchangeId', type: 'uint128' },\n ],\n },\n {\n verifyingChainId: reyaChainId,\n caller: caller,\n accountId: accountId,\n commands: commands,\n nonce: nonce,\n deadline: deadline,\n extraSignatureData: ethers.AbiCoder.defaultAbiCoder().encode([], []),\n },\n );\n\n return convertEthersSignatureToEIP712Signature(signature, deadline);\n}\n\nexport async function signPoolRemoveLiquidity(\n signer: Signer | JsonRpcSigner,\n reyaChainId: ReyaChainId,\n caller: Address,\n owner: Address,\n poolId: number,\n sharesAmount: bigint,\n minOut: bigint,\n nonce: number,\n deadline: number,\n): Promise<EIP712Signature> {\n // @todo extend\n const signature = await signReyaTypedData(\n signer,\n getAddress(reyaChainId, ContractType.PASSIVE_POOL_PROXY),\n {\n RemoveLiquidityBySig: [\n { name: 'verifyingChainId', type: 'uint256' },\n { name: 'caller', type: 'address' },\n { name: 'owner', type: 'address' },\n { name: 'poolId', type: 'uint128' },\n { name: 'sharesAmount', type: 'uint256' },\n { name: 'minOut', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n },\n {\n verifyingChainId: reyaChainId,\n caller: caller,\n owner: owner,\n poolId: poolId,\n sharesAmount: sharesAmount,\n minOut: minOut,\n nonce: nonce,\n deadline: deadline,\n },\n );\n\n return convertEthersSignatureToEIP712Signature(signature, deadline);\n}\n\nasync function signReyaTypedData(\n signer: Signer | JsonRpcSigner,\n verifyingContract: string,\n types: Record<string, Array<TypedDataField>>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>,\n): Promise<Signature> {\n const domain = {\n name: 'Reya',\n version: '1',\n verifyingContract: verifyingContract,\n };\n\n const signatureString = await signer.signTypedData(domain, types, value);\n\n return Signature.from(signatureString);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"/","sources":["services/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE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EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CAiC1B;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CA8B1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
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.63.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": "7dd183df9c38e88d56dc28cff596adf64f1094f1"
|
|
38
38
|
}
|
|
@@ -54,7 +54,7 @@ export async function estimateGas(
|
|
|
54
54
|
|
|
55
55
|
if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {
|
|
56
56
|
const maxPriorityFeePerGas: bigint = BigInt('0');
|
|
57
|
-
const maxFeePerGas: bigint = BigInt('
|
|
57
|
+
const maxFeePerGas: bigint = BigInt('100000000');
|
|
58
58
|
return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };
|
|
59
59
|
}
|
|
60
60
|
|
package/src/services/sign.ts
CHANGED