@reyaxyz/sdk 0.45.1 → 0.46.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/config/index.js.map +1 -1
- package/dist/services/executeTransaction.js +8 -8
- package/dist/services/executeTransaction.js.map +1 -1
- package/dist/services/margin-accounts/account.js +1 -0
- package/dist/services/margin-accounts/account.js.map +1 -1
- package/dist/services/margin-accounts/types.js.map +1 -1
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/index.d.ts.map +1 -1
- package/dist/types/services/executeTransaction.d.ts +1 -0
- package/dist/types/services/executeTransaction.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/account.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/types.d.ts +1 -0
- package/dist/types/services/margin-accounts/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/config/index.ts +1 -1
- package/src/services/executeTransaction.ts +8 -7
- package/src/services/margin-accounts/account.ts +1 -0
- package/src/services/margin-accounts/types.ts +1 -0
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAgF;AAUhF;IAAuC,qCAAU;IAAjD;;IAkBA,CAAC;IAjBO,8CAAkB,GAAxB,UACE,MAAc,EACd,eAAuB,EACvB,QAAsC;;;;gBAGhC,GAAG,GAAG,0BAA0B,CAAC;gBACvC,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,MAAM,EAAE,MAAM;wBACd,eAAe,iBAAA;wBACf,QAAQ,UAAA;qBACT,CACF,EAAC;;;KACH;IACH,wBAAC;AAAD,CAAC,AAlBD,CAAuC,mBAAU,GAkBhD;AAlBY,8CAAiB;AAoB9B,iBAAiB;AACjB,IAAI,iBAAiB,GAAsB,IAAI,iBAAiB,CAC9D,2BAAkB,CAAC,MAAM,CAAC,CAAC,WAAW,CACvC,CAAC;AAEF,gCAAgC;AACzB,IAAM,YAAY,GAAG,UAC1B,WAAyC;IAEzC,IAAM,MAAM,GAAG,2BAAkB,CAAC,WAAW,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,CAAC;IAC7E,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAChE,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,IAAM,0BAA0B,GAAG;IACxC,IAAI,CAAC,iBAAiB;QACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAJW,QAAA,0BAA0B,8BAIrC","sourcesContent":["import { API_CLIENT_CONFIGS, RestClient, ServiceConfig } from '@reyaxyz/common';\n\nexport type BroadcastTransactionMetadata = {\n accountName?: string;\n};\n\nexport type TxData = {\n to: string;\n data: string;\n};\nexport class TransactionModule extends RestClient {\n async executeTransaction(\n txData: TxData,\n contractAddress: string,\n metadata: BroadcastTransactionMetadata,\n ) {\n // const uri = `/api/transaction-gelato/executeGelato`;\n const uri = `/api/transaction/execute`; // @todo switch between Gelato and internal relayer\n return this.post<{ txHash: string }>(\n uri,\n {},\n {\n txData: txData,\n contractAddress,\n metadata,\n },\n );\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\n\n// Function to configure the SDK\nexport const configureSDK = (\n environment: ServiceConfig['environment'],\n): void => {\n const config = API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n transactionModule = new TransactionModule(config.apiEndpoint);\n};\n\nexport const getTransactionModuleClient = (): TransactionModule => {\n if (!transactionModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return transactionModule;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAgF;AAUhF;IAAuC,qCAAU;IAAjD;;IAkBA,CAAC;IAjBO,8CAAkB,GAAxB,UACE,MAAc,EACd,eAAuB,EACvB,QAAsC;;;;gBAGhC,GAAG,GAAG,0BAA0B,CAAC;gBACvC,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,MAAM,EAAE,MAAM;wBACd,eAAe,iBAAA;wBACf,QAAQ,UAAA;qBACT,CACF,EAAC;;;KACH;IACH,wBAAC;AAAD,CAAC,AAlBD,CAAuC,mBAAU,GAkBhD;AAlBY,8CAAiB;AAoB9B,iBAAiB;AACjB,IAAI,iBAAiB,GAAsB,IAAI,iBAAiB,CAC9D,2BAAkB,CAAC,MAAM,CAAC,CAAC,WAAW,CACvC,CAAC;AAEF,gCAAgC;AACzB,IAAM,YAAY,GAAG,UAC1B,WAAyC;IAEzC,IAAM,MAAM,GAAG,2BAAkB,CAAC,WAAW,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,CAAC;IAC7E,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAChE,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,IAAM,0BAA0B,GAAG;IACxC,IAAI,CAAC,iBAAiB;QACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAJW,QAAA,0BAA0B,8BAIrC","sourcesContent":["import { API_CLIENT_CONFIGS, RestClient, ServiceConfig } from '@reyaxyz/common';\n\nexport type BroadcastTransactionMetadata = {\n accountName?: string;\n};\n\nexport type TxData = {\n to: string;\n data: string;\n};\nexport class TransactionModule extends RestClient {\n async executeTransaction(\n txData: TxData,\n contractAddress: string,\n metadata: BroadcastTransactionMetadata,\n ) {\n // const uri = `/api/transaction-gelato/executeGelato`;\n const uri = `/api/transaction/execute`; // @todo switch between Gelato and internal relayer\n return this.post<{ txHash: string; accountId?: string }>(\n uri,\n {},\n {\n txData: txData,\n contractAddress,\n metadata,\n },\n );\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\n\n// Function to configure the SDK\nexport const configureSDK = (\n environment: ServiceConfig['environment'],\n): void => {\n const config = API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n transactionModule = new TransactionModule(config.apiEndpoint);\n};\n\nexport const getTransactionModuleClient = (): TransactionModule => {\n if (!transactionModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return transactionModule;\n};\n"]}
|
|
@@ -120,23 +120,23 @@ function executeTransaction(signer, data, value, chainId, targetContract) {
|
|
|
120
120
|
exports.executeTransaction = executeTransaction;
|
|
121
121
|
function signAndBroadcastTransaction(signer, data, value, chainId, targetContract, metadata) {
|
|
122
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
-
var contractAddress, transactionModuleClient, txHash, error_3;
|
|
124
|
-
return __generator(this, function (
|
|
125
|
-
switch (
|
|
123
|
+
var contractAddress, transactionModuleClient, _a, txHash, accountId, error_3;
|
|
124
|
+
return __generator(this, function (_b) {
|
|
125
|
+
switch (_b.label) {
|
|
126
126
|
case 0:
|
|
127
127
|
contractAddress = Object.values(contractAddresses_1.ContractType).includes(targetContract)
|
|
128
128
|
? (0, contractAddresses_1.getAddress)(chainId, targetContract)
|
|
129
129
|
: targetContract;
|
|
130
|
-
|
|
130
|
+
_b.label = 1;
|
|
131
131
|
case 1:
|
|
132
|
-
|
|
132
|
+
_b.trys.push([1, 3, , 4]);
|
|
133
133
|
transactionModuleClient = (0, config_1.getTransactionModuleClient)();
|
|
134
134
|
return [4 /*yield*/, transactionModuleClient.executeTransaction({ to: contractAddress, data: data }, contractAddress, metadata)];
|
|
135
135
|
case 2:
|
|
136
|
-
|
|
137
|
-
return [2 /*return*/, { hash: txHash }];
|
|
136
|
+
_a = _b.sent(), txHash = _a.txHash, accountId = _a.accountId;
|
|
137
|
+
return [2 /*return*/, { hash: txHash, accountId: accountId }];
|
|
138
138
|
case 3:
|
|
139
|
-
error_3 =
|
|
139
|
+
error_3 = _b.sent();
|
|
140
140
|
console.warn(error_3);
|
|
141
141
|
throw new Error('Transaction Execution Error');
|
|
142
142
|
case 4: return [2 /*return*/];
|
|
@@ -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,CAAC,CAAC,cAAc,CAAC;oBACb,EAAE,cACN,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,eAAe,EACnB,IAAI,MAAA,IACD,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACpD,CAAC;oBAEE,QAAQ,GAAW,MAAM,CAAC,SAAS,CAAC,CAAC;;;;oBAGnB,qBAAM,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,EAAA;;oBAA1C,WAAW,GAAG,SAA4B;oBAChD,QAAQ,GAAG,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AAG,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('0');\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"]}
|
|
@@ -56,6 +56,7 @@ var createAccount = function (params) { return __awaiter(void 0, void 0, void 0,
|
|
|
56
56
|
result = _c.sent();
|
|
57
57
|
return [2 /*return*/, {
|
|
58
58
|
transactionHash: (result === null || result === void 0 ? void 0 : result.hash) || null,
|
|
59
|
+
accountId: Number(result === null || result === void 0 ? void 0 : result.accountId),
|
|
59
60
|
}];
|
|
60
61
|
}
|
|
61
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"/","sources":["services/margin-accounts/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAoE;AACpE,mCAAmD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,MAAM,EACb,IAAI,EACJ,KAAK,EACL,OAAO,EACP,gCAAY,CAAC,UAAU,EACvB,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,CAC7B,EAAA;;gBAPK,MAAM,GAAG,SAOd;gBACD,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;wBACrC,SAAS,EAAE,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAC;qBACrC,EAAC;;;KACH,CAAC;AAtBW,QAAA,aAAa,iBAsBxB","sourcesContent":["import { signAndBroadcastTransaction } from '../executeTransaction';\nimport { encodeCreateAccountCall } from './encode';\nimport { CreateAccountParams, CreateAccountResult } from './types';\nimport { ContractType } from '../../utils/contractAddresses';\n\nexport const createAccount = async (\n params: CreateAccountParams,\n): Promise<CreateAccountResult> => {\n const { calldata: data, value } = encodeCreateAccountCall(\n params.ownerAddress,\n );\n\n const network = await params.signer.provider?.getNetwork();\n const chainId = Number(network?.chainId);\n\n const result = await signAndBroadcastTransaction(\n params.signer,\n data,\n value,\n chainId,\n ContractType.CORE_PROXY,\n { accountName: params.name },\n );\n return {\n transactionHash: result?.hash || null,\n accountId: Number(result?.accountId),\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["services/margin-accounts/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport {\n MarginAccountEntity,\n MoneyInOutChainId,\n OwnerMetadataEntity,\n TokenEntity,\n} from '@reyaxyz/common';\n\nexport type CreateAccountParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: string;\n name: string;\n};\n\nexport type CreateAccountResult = {\n transactionHash: string | null;\n};\n\nexport type DepositParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type DepositResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type WithdrawResult = {\n transactionHash: string | null;\n};\n\nexport type SimulateDepositResult = {\n bridgeGasFees: number;\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateDepositParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type SimulateWithdrawResult = {\n bridgeGasFees: number;\n\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateWithdrawParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type TransferMarginBetweenAccountsParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'coreSigNonce'>;\n fromMarginAccountId: MarginAccountEntity['id'];\n toMarginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type TransferMarginBetweenAccountsResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawMAAndBridgeParams = {\n signer: Signer | JsonRpcSigner;\n moneyInOutChainId: MoneyInOutChainId;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n // if not provided it has same value as owner.address\n receiverAddress?: Lowercase<string>;\n};\n\nexport type WithdrawMAAndBridgeParamsResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositNewMAParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: OwnerMetadataEntity['address'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type BridgeAndDepositNewMAResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositExistingMAParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type BridgeAndDepositExistingMAResult = {\n transactionHash: string | null;\n};\n\nexport type SimulateTransferMarginBetweenAccountsResult = {\n bridgeGasFees: number;\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateTransferMarginBetweenAccountsParams = {\n signer: Signer | JsonRpcSigner;\n fromMarginAccountId: MarginAccountEntity['id'];\n toMarginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["services/margin-accounts/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport {\n MarginAccountEntity,\n MoneyInOutChainId,\n OwnerMetadataEntity,\n TokenEntity,\n} from '@reyaxyz/common';\n\nexport type CreateAccountParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: string;\n name: string;\n};\n\nexport type CreateAccountResult = {\n transactionHash: string | null;\n accountId: number | null;\n};\n\nexport type DepositParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type DepositResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type WithdrawResult = {\n transactionHash: string | null;\n};\n\nexport type SimulateDepositResult = {\n bridgeGasFees: number;\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateDepositParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type SimulateWithdrawResult = {\n bridgeGasFees: number;\n\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateWithdrawParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type TransferMarginBetweenAccountsParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'coreSigNonce'>;\n fromMarginAccountId: MarginAccountEntity['id'];\n toMarginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type TransferMarginBetweenAccountsResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawMAAndBridgeParams = {\n signer: Signer | JsonRpcSigner;\n moneyInOutChainId: MoneyInOutChainId;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n // if not provided it has same value as owner.address\n receiverAddress?: Lowercase<string>;\n};\n\nexport type WithdrawMAAndBridgeParamsResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositNewMAParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: OwnerMetadataEntity['address'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type BridgeAndDepositNewMAResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositExistingMAParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n\nexport type BridgeAndDepositExistingMAResult = {\n transactionHash: string | null;\n};\n\nexport type SimulateTransferMarginBetweenAccountsResult = {\n bridgeGasFees: number;\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateTransferMarginBetweenAccountsParams = {\n signer: Signer | JsonRpcSigner;\n fromMarginAccountId: MarginAccountEntity['id'];\n toMarginAccountId: MarginAccountEntity['id'];\n tokenAddress: TokenEntity['address'];\n amount: number;\n};\n"]}
|
|
@@ -9,6 +9,7 @@ export type TxData = {
|
|
|
9
9
|
export declare class TransactionModule extends RestClient {
|
|
10
10
|
executeTransaction(txData: TxData, contractAddress: string, metadata: BroadcastTransactionMetadata): Promise<{
|
|
11
11
|
txHash: string;
|
|
12
|
+
accountId?: string | undefined;
|
|
12
13
|
}>;
|
|
13
14
|
}
|
|
14
15
|
export declare const configureSDK: (environment: ServiceConfig['environment']) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,kBAAkB,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,4BAA4B;gBAIX,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,kBAAkB,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,4BAA4B;gBAIX,MAAM;;;CAUpC;AAQD,eAAO,MAAM,YAAY,gBACV,aAAa,CAAC,aAAa,CAAC,KACxC,IAGF,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC"}
|
|
@@ -15,5 +15,6 @@ export declare function estimateGas(signer: Signer | JsonRpcSigner, data: string
|
|
|
15
15
|
export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
|
|
16
16
|
export declare function signAndBroadcastTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string, metadata: BroadcastTransactionMetadata): Promise<{
|
|
17
17
|
hash: string;
|
|
18
|
+
accountId?: string;
|
|
18
19
|
}>;
|
|
19
20
|
//# 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,OAAO,EACL,4BAA4B,EAE7B,MAAM,WAAW,CAAC;AAGnB,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EA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AAE,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,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CAiCA;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;AAED,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,EACrC,QAAQ,EAAE,4BAA4B,GACrC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmB/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"/","sources":["services/margin-accounts/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnE,eAAO,MAAM,aAAa,WAChB,mBAAmB,KAC1B,QAAQ,mBAAmB,
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"/","sources":["services/margin-accounts/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnE,eAAO,MAAM,aAAa,WAChB,mBAAmB,KAC1B,QAAQ,mBAAmB,CAoB7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/margin-accounts/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/margin-accounts/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,EA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M,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,cAAc,CAAC,CAAC;IAC7D,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,2CAA2C,GAAG;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;IAC5D,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;CAC3D,CAAC;AAGF,MAAM,MAAM,2CAA2C,GAAG;IACxD,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC/C,iBAAiB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC7C,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.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.53.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": "49b10d7c09c1a94e4c11d57e328423c3d304c686"
|
|
38
38
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class TransactionModule extends RestClient {
|
|
|
16
16
|
) {
|
|
17
17
|
// const uri = `/api/transaction-gelato/executeGelato`;
|
|
18
18
|
const uri = `/api/transaction/execute`; // @todo switch between Gelato and internal relayer
|
|
19
|
-
return this.post<{ txHash: string }>(
|
|
19
|
+
return this.post<{ txHash: string; accountId?: string }>(
|
|
20
20
|
uri,
|
|
21
21
|
{},
|
|
22
22
|
{
|
|
@@ -93,7 +93,7 @@ export async function signAndBroadcastTransaction(
|
|
|
93
93
|
chainId: number,
|
|
94
94
|
targetContract: ContractType | string,
|
|
95
95
|
metadata: BroadcastTransactionMetadata,
|
|
96
|
-
): Promise<{ hash: string }> {
|
|
96
|
+
): Promise<{ hash: string; accountId?: string }> {
|
|
97
97
|
const contractAddress = Object.values(ContractType).includes(
|
|
98
98
|
targetContract as ContractType,
|
|
99
99
|
)
|
|
@@ -101,12 +101,13 @@ export async function signAndBroadcastTransaction(
|
|
|
101
101
|
: targetContract;
|
|
102
102
|
try {
|
|
103
103
|
const transactionModuleClient = getTransactionModuleClient();
|
|
104
|
-
const { txHash } =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const { txHash, accountId } =
|
|
105
|
+
await transactionModuleClient.executeTransaction(
|
|
106
|
+
{ to: contractAddress, data: data },
|
|
107
|
+
contractAddress,
|
|
108
|
+
metadata,
|
|
109
|
+
);
|
|
110
|
+
return { hash: txHash, accountId };
|
|
110
111
|
} catch (error) {
|
|
111
112
|
console.warn(error);
|
|
112
113
|
throw new Error('Transaction Execution Error');
|