@reyaxyz/sdk 0.83.2 → 0.85.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAgBzB;IAAuC,qCAAU;IAAjD;;IAwCA,CAAC;IAvCO,8CAAkB,GAAxB,UACE,MAAc,EACd,eAAuB,EACvB,QAAsC;;;;gBAEhC,GAAG,GAAG,uCAAuC,CAAC;gBACpD,uFAAuF;gBACvF,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,MAAM,EAAE,MAAM;wBACd,eAAe,iBAAA;wBACf,QAAQ,UAAA;qBACT,CACF,EAAC;;;KACH;IAEK,kDAAsB,GAA5B,UACE,eAAuB,EACvB,eAAuB,EACvB,aAAqB,EACrB,MAAc,EACd,OAAe,EACf,IAAY;;;;gBAEN,GAAG,GAAG,wBAAiB,eAAe,8BAA2B,CAAC;gBACxE,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,OAAO,EAAE,eAAe;wBACxB,eAAe,EAAE,aAAa;wBAC9B,MAAM,QAAA;wBACN,QAAQ,EAAE,OAAO;wBACjB,IAAI,EAAE,IAAI;qBACX,CACF,EAAC;;;KACH;IACH,wBAAC;AAAD,CAAC,AAxCD,CAAuC,mBAAU,GAwChD;AAxCY,8CAAiB;AA0C9B;IAAsC,oCAAU;IAAhD;;IAUA,CAAC;IATO,iDAAsB,GAA5B,UAA6B,MAAsB;;;;gBAE3C,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAChC,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;gBACvD,QAAQ,CAAC,MAAM,CAAC,YAAY,EA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AChE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC","sourcesContent":["import {\n Address,\n API_CLIENT_CONFIGS,\n RestClient,\n ServiceConfig,\n} from '@reyaxyz/common';\n\nexport type BroadcastTransactionMetadata = {\n accountName?: string;\n};\n\nexport type TxData = {\n to: string;\n data: string;\n};\n\ntype AlphaTermsData = {\n walletAddress: Address;\n link: string;\n};\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`; //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 async pushPendingTransaction(\n marginAccountId: number,\n transactionHash: string,\n sourceChainId: number,\n amount: number,\n assetId: string,\n type: string,\n ) {\n const uri = `/api/accounts/${marginAccountId}/push-pending-transaction`;\n return this.post<{ successful: boolean }>(\n uri,\n {},\n {\n tx_hash: transactionHash,\n source_chain_id: sourceChainId,\n amount,\n asset_id: assetId,\n type: type,\n },\n );\n }\n}\n\nexport class AlphaTermsModule extends RestClient {\n async registerAlphaSignature(params: AlphaTermsData): Promise<void> {\n // Build formData object.\n const formData = new FormData();\n formData.append('walletAddress', params.walletAddress);\n formData.append('signedLink', params.link);\n\n const uri = '/api/tos/alpha-signatures';\n return this.post(uri, undefined, formData, undefined);\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\nlet alphaTermsModule: AlphaTermsModule = new AlphaTermsModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\n\nlet sdkEnv: ServiceConfig['environment'] = 'test';\n\nexport const getSdkEnvironment = (): ServiceConfig['environment'] => {\n return sdkEnv;\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 sdkEnv = environment;\n transactionModule = new TransactionModule(config.apiEndpoint);\n alphaTermsModule = new AlphaTermsModule(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\nexport const getAlphaTermsModuleClient = (): AlphaTermsModule => {\n if (!alphaTermsModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return alphaTermsModule;\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAiBzB;IAAuC,qCAAU;IAAjD;;IAwCA,CAAC;IAvCO,8CAAkB,GAAxB,UACE,MAAc,EACd,eAAuB,EACvB,QAAsC;;;;gBAEhC,GAAG,GAAG,uCAAuC,CAAC;gBACpD,uFAAuF;gBACvF,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,MAAM,EAAE,MAAM;wBACd,eAAe,iBAAA;wBACf,QAAQ,UAAA;qBACT,CACF,EAAC;;;KACH;IAEK,kDAAsB,GAA5B,UACE,eAAuB,EACvB,eAAuB,EACvB,aAAqB,EACrB,MAAc,EACd,OAAe,EACf,IAAY;;;;gBAEN,GAAG,GAAG,wBAAiB,eAAe,8BAA2B,CAAC;gBACxE,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;wBACE,OAAO,EAAE,eAAe;wBACxB,eAAe,EAAE,aAAa;wBAC9B,MAAM,QAAA;wBACN,QAAQ,EAAE,OAAO;wBACjB,IAAI,EAAE,IAAI;qBACX,CACF,EAAC;;;KACH;IACH,wBAAC;AAAD,CAAC,AAxCD,CAAuC,mBAAU,GAwChD;AAxCY,8CAAiB;AA0C9B;IAAsC,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ACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAJW,QAAA,0BAA0B,8BAIrC;AAEK,IAAM,yBAAyB,GAAG;IACvC,IAAI,CAAC,gBAAgB;QACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC","sourcesContent":["import {\n Address,\n API_CLIENT_CONFIGS,\n RestClient,\n ServiceConfig,\n} from '@reyaxyz/common';\n\nexport type BroadcastTransactionMetadata = {\n accountName?: string;\n destinationType?: 'pool' | 'account';\n};\n\nexport type TxData = {\n to: string;\n data: string;\n};\n\ntype AlphaTermsData = {\n walletAddress: Address;\n link: string;\n};\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`; //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 async pushPendingTransaction(\n marginAccountId: number,\n transactionHash: string,\n sourceChainId: number,\n amount: number,\n assetId: string,\n type: string,\n ) {\n const uri = `/api/accounts/${marginAccountId}/push-pending-transaction`;\n return this.post<{ successful: boolean }>(\n uri,\n {},\n {\n tx_hash: transactionHash,\n source_chain_id: sourceChainId,\n amount,\n asset_id: assetId,\n type: type,\n },\n );\n }\n}\n\nexport class AlphaTermsModule extends RestClient {\n async registerAlphaSignature(params: AlphaTermsData): Promise<void> {\n // Build formData object.\n const formData = new FormData();\n formData.append('walletAddress', params.walletAddress);\n formData.append('signedLink', params.link);\n\n const uri = '/api/tos/alpha-signatures';\n return this.post(uri, undefined, formData, undefined);\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\nlet alphaTermsModule: AlphaTermsModule = new AlphaTermsModule(\n API_CLIENT_CONFIGS['test'].apiEndpoint,\n);\n\nlet sdkEnv: ServiceConfig['environment'] = 'test';\n\nexport const getSdkEnvironment = (): ServiceConfig['environment'] => {\n return sdkEnv;\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 sdkEnv = environment;\n transactionModule = new TransactionModule(config.apiEndpoint);\n alphaTermsModule = new AlphaTermsModule(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\nexport const getAlphaTermsModuleClient = (): AlphaTermsModule => {\n if (!alphaTermsModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return alphaTermsModule;\n};\n"]}
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.withdrawPassivePoolAndBridge = void 0;
40
40
  var encode_1 = require("./encode");
41
41
  var common_1 = require("@reyaxyz/common");
42
+ var signAndBroadcastTransaction_1 = require("../signAndBroadcastTransaction");
42
43
  var withdrawPassivePoolAndBridge = function (params) { return __awaiter(void 0, void 0, void 0, function () {
43
44
  var network, reyaChainId, sharesAmount, eip712Signature, _a, data, value, result;
44
45
  var _b;
@@ -60,7 +61,9 @@ var withdrawPassivePoolAndBridge = function (params) { return __awaiter(void 0,
60
61
  eip712Signature = _c.sent();
61
62
  _a = (0, encode_1.encodeWithdrawPassivePoolAndBridge)(params.owner.address, params.pool.id, sharesAmount, BigInt(0), eip712Signature, BigInt('10000000'), //todo
62
63
  params.moneyInOutChainId, params.owner.address), data = _a.calldata, value = _a.value;
63
- return [4 /*yield*/, (0, common_1.executeTransaction)(params.signer, data, value, reyaChainId, common_1.ContractType.PERIPHERY_PROXY)];
64
+ return [4 /*yield*/, (0, signAndBroadcastTransaction_1.signAndBroadcastTransaction)(params.signer, data, value, reyaChainId, common_1.ContractType.PERIPHERY_PROXY, {
65
+ destinationType: 'pool',
66
+ })];
64
67
  case 3:
65
68
  result = _c.sent();
66
69
  return [2 /*return*/, {
@@ -1 +1 @@
1
- {"version":3,"file":"withdrawPassivePoolAndBridge.js","sourceRoot":"/","sources":["services/lp/withdrawPassivePoolAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mCAA8D;AAC9D,0CASyB;AAElB,IAAM,4BAA4B,GAAG,UAC1C,MAA0C;;;;;oBAE1B,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBACpD,WAAW,GAAgB,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;gBAG1D,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;oBACvB,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC9D,CAAC;gBAEuB,qBAAM,IAAA,gCAAuB,EACnD,MAAM,CAAC,MAAM,EACb,WAAW,EACX,IAAA,mBAAU,EAAC,WAAW,EAAE,qBAAY,CAAC,eAAe,CAAC,EACrD,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,EAC7B,IAAA,qCAA4B,GAAE,GAAG,mCAA0B,EAC3D,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM;oBAC1B,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,EAAA;;gBAbK,eAAe,GAAG,SAavB;gBAEK,KAA4B,IAAA,2CAAkC,EAClE,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,eAAe,EACf,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM;gBAC1B,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,EATiB,IAAI,cAAA,EAAE,KAAK,WAAA,CAS3B;gBAEa,qBAAM,IAAA,2BAAkB,EACrC,MAAM,CAAC,MAAM,EACb,IAAI,EACJ,KAAK,EACL,WAAW,EACX,qBAAY,CAAC,eAAe,CAC7B,EAAA;;gBANK,MAAM,GAAG,SAMd;gBAED,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;KACH,CAAC;AAlDW,QAAA,4BAA4B,gCAkDvC","sourcesContent":["import {\n WithdrawPassivePoolAndBridgeParams,\n WithdrawPassivePoolAndBridgeResult,\n} from './types';\nimport { encodeWithdrawPassivePoolAndBridge } from './encode';\nimport {\n ReyaChainId,\n getCurrentTimestampInSeconds,\n scale,\n signPoolRemoveLiquidity,\n ContractType,\n getAddress,\n BRIDGE_DEADLINE_IN_SECONDS,\n executeTransaction,\n} from '@reyaxyz/common';\n\nexport const withdrawPassivePoolAndBridge = async (\n params: WithdrawPassivePoolAndBridgeParams,\n): Promise<WithdrawPassivePoolAndBridgeResult> => {\n const network = await params.signer.provider?.getNetwork();\n const reyaChainId: ReyaChainId = Number(network?.chainId);\n\n let sharesAmount;\n if (params.withdrawMax) {\n sharesAmount = scale(30)(params.sharesAmount);\n } else {\n sharesAmount = scale(30)(params.amount / params.sharePrice);\n }\n\n const eip712Signature = await signPoolRemoveLiquidity(\n params.signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n params.owner.poolSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n BigInt('10000000'), //todo\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const { calldata: data, value } = encodeWithdrawPassivePoolAndBridge(\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n eip712Signature,\n BigInt('10000000'), //todo\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n );\n\n return {\n transactionHash: result?.hash || null,\n };\n};\n"]}
1
+ {"version":3,"file":"withdrawPassivePoolAndBridge.js","sourceRoot":"/","sources":["services/lp/withdrawPassivePoolAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mCAA8D;AAC9D,0CAQyB;AACzB,8EAA6E;AAEtE,IAAM,4BAA4B,GAAG,UAC1C,MAA0C;;;;;oBAE1B,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBACpD,WAAW,GAAgB,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;gBAG1D,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;oBACvB,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC9D,CAAC;gBAEuB,qBAAM,IAAA,gCAAuB,EACnD,MAAM,CAAC,MAAM,EACb,WAAW,EACX,IAAA,mBAAU,EAAC,WAAW,EAAE,qBAAY,CAAC,eAAe,CAAC,EACrD,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,EAC7B,IAAA,qCAA4B,GAAE,GAAG,mCAA0B,EAC3D,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM;oBAC1B,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,EAAA;;gBAbK,eAAe,GAAG,SAavB;gBAEK,KAA4B,IAAA,2CAAkC,EAClE,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,eAAe,EACf,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM;gBAC1B,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,EATiB,IAAI,cAAA,EAAE,KAAK,WAAA,CAS3B;gBAEa,qBAAM,IAAA,yDAA2B,EAC9C,MAAM,CAAC,MAAM,EACb,IAAI,EACJ,KAAK,EACL,WAAW,EACX,qBAAY,CAAC,eAAe,EAC5B;wBACE,eAAe,EAAE,MAAM;qBACxB,CACF,EAAA;;gBATK,MAAM,GAAG,SASd;gBAED,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;KACH,CAAC;AArDW,QAAA,4BAA4B,gCAqDvC","sourcesContent":["import {\n WithdrawPassivePoolAndBridgeParams,\n WithdrawPassivePoolAndBridgeResult,\n} from './types';\nimport { encodeWithdrawPassivePoolAndBridge } from './encode';\nimport {\n ReyaChainId,\n getCurrentTimestampInSeconds,\n scale,\n signPoolRemoveLiquidity,\n ContractType,\n getAddress,\n BRIDGE_DEADLINE_IN_SECONDS,\n} from '@reyaxyz/common';\nimport { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';\n\nexport const withdrawPassivePoolAndBridge = async (\n params: WithdrawPassivePoolAndBridgeParams,\n): Promise<WithdrawPassivePoolAndBridgeResult> => {\n const network = await params.signer.provider?.getNetwork();\n const reyaChainId: ReyaChainId = Number(network?.chainId);\n\n let sharesAmount;\n if (params.withdrawMax) {\n sharesAmount = scale(30)(params.sharesAmount);\n } else {\n sharesAmount = scale(30)(params.amount / params.sharePrice);\n }\n\n const eip712Signature = await signPoolRemoveLiquidity(\n params.signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n params.owner.poolSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n BigInt('10000000'), //todo\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const { calldata: data, value } = encodeWithdrawPassivePoolAndBridge(\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n eip712Signature,\n BigInt('10000000'), //todo\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const result = await signAndBroadcastTransaction(\n params.signer,\n data,\n value,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n {\n destinationType: 'pool',\n },\n );\n\n return {\n transactionHash: result?.hash || null,\n };\n};\n"]}
@@ -66,7 +66,9 @@ var withdrawMAAndBridge = function (_a) {
66
66
  case 2:
67
67
  eip712Signature = _e.sent();
68
68
  _c = (0, encode_1.encodeWithdrawMAAndBridge)(marginAccountId, corePeripheryTokenInfo.address, (0, common_1.scale)(corePeripheryTokenInfo.decimals)(unscaledAmount), eip712Signature, socketMsgGasLimit, moneyInOutChainId, receiverAddress), data = _c.calldata, value = _c.value;
69
- return [4 /*yield*/, (0, signAndBroadcastTransaction_1.signAndBroadcastTransaction)(signer, data, value, reyaChainId, common_2.ContractType.PERIPHERY_PROXY, {})];
69
+ return [4 /*yield*/, (0, signAndBroadcastTransaction_1.signAndBroadcastTransaction)(signer, data, value, reyaChainId, common_2.ContractType.PERIPHERY_PROXY, {
70
+ destinationType: 'account',
71
+ })];
70
72
  case 3:
71
73
  result = _e.sent();
72
74
  if (!(result === null || result === void 0 ? void 0 : result.hash)) {
@@ -1 +1 @@
1
- {"version":3,"file":"withdrawMAAndBridge.js","sourceRoot":"/","sources":["services/margin-accounts/withdrawMAAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AACzB,0CAA2D;AAC3D,8EAA6E;AAC7E,0CAAmD;AACnD,mCAAqD;AAKrD,0CAA6D;AAC7D,oCAAiD;AACjD,0CAA8C;AAC9C,iCAAgC;AAChC,uCAA0D;AAEnD,IAAM,mBAAmB,GAAG,UAAO,EAQd;QAP1B,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,eAAe,qBAAA,EACf,KAAK,WAAA,EACG,cAAc,YAAA,EACtB,YAAY,kBAAA,EACZ,uBAA+B,EAA/B,eAAe,mBAAG,KAAK,CAAC,OAAO,KAAA;;;;;;wBAEf,qBAAM,CAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;oBAA7C,OAAO,GAAG,SAAmC;oBAC7C,WAAW,GAAgB,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;oBAEpD,sBAAsB,GAAG,IAAA,8BAAqB,EAAC,YAAY,CAAC,CAAC;oBAE7D,WAAW,GAAG,IAAI,oBAAW,EAAE,CAAC;oBACtC,IAAA,6BAAoB,EAClB,sBAAsB,CAAC,OAAO,EAC9B,IAAA,cAAK,EAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,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,EAC9B,YAAY,CACb,EAAA;;oBAPD,SAOC,CAAC;;;;oBAEF,OAAO,CAAC,GAAG,CAAC,+CAA+C,EAAE,OAAK,CAAC,CAAC;;wBAGtE,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;;CACH,CAAC;AA9EW,QAAA,mBAAmB,uBA8E9B","sourcesContent":["import {\n getCurrentTimestampInSeconds,\n scale,\n ReyaChainId,\n getTokenInfoByAddress,\n} from '@reyaxyz/common';\nimport { ContractType, getAddress } from '@reyaxyz/common';\nimport { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';\nimport { signCoreCommands } from '@reyaxyz/common';\nimport { encodeWithdrawMAAndBridge } from './encode';\nimport {\n WithdrawMAAndBridgeParams,\n WithdrawMAAndBridgeParamsResult,\n} from './types';\nimport { BRIDGE_DEADLINE_IN_SECONDS } from '@reyaxyz/common';\nimport { encodeSingleWithdraw } from '../encode';\nimport { MultiAction } from '@reyaxyz/common';\nimport { ethers } from 'ethers';\nimport { getTransactionModuleClient } from '../../config';\n\nexport const withdrawMAAndBridge = async ({\n signer,\n moneyInOutChainId,\n marginAccountId,\n owner,\n amount: unscaledAmount,\n tokenAddress,\n receiverAddress = owner.address,\n}: WithdrawMAAndBridgeParams): Promise<WithdrawMAAndBridgeParamsResult> => {\n const network = await signer.provider?.getNetwork();\n const reyaChainId: ReyaChainId = Number(network?.chainId);\n\n const corePeripheryTokenInfo = getTokenInfoByAddress(tokenAddress);\n\n const multiAction = new MultiAction();\n encodeSingleWithdraw(\n corePeripheryTokenInfo.address,\n scale(corePeripheryTokenInfo.decimals)(unscaledAmount),\n multiAction,\n );\n\n const socketMsgGasLimit = BigInt('10000000');\n const eip712Signature = await signCoreCommands(\n signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n marginAccountId,\n multiAction.commands,\n owner.coreSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode(\n ['address', 'uint256', 'uint256'],\n [receiverAddress, moneyInOutChainId, socketMsgGasLimit],\n ),\n );\n\n const { calldata: data, value } = encodeWithdrawMAAndBridge(\n marginAccountId,\n corePeripheryTokenInfo.address,\n scale(corePeripheryTokenInfo.decimals)(unscaledAmount),\n eip712Signature,\n socketMsgGasLimit,\n moneyInOutChainId,\n receiverAddress,\n );\n\n const result = await signAndBroadcastTransaction(\n signer,\n data,\n value,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n {},\n );\n\n if (!result?.hash) {\n return {\n transactionHash: null,\n };\n }\n\n try {\n const transactionModuleClient = getTransactionModuleClient();\n await transactionModuleClient.pushPendingTransaction(\n marginAccountId,\n result.hash,\n moneyInOutChainId,\n unscaledAmount,\n corePeripheryTokenInfo.address,\n 'withdrawal',\n );\n } catch (error) {\n console.log('Error persisting pending withdraw transaction', error);\n }\n\n return {\n transactionHash: result?.hash || null,\n };\n};\n"]}
1
+ {"version":3,"file":"withdrawMAAndBridge.js","sourceRoot":"/","sources":["services/margin-accounts/withdrawMAAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AACzB,0CAA2D;AAC3D,8EAA6E;AAC7E,0CAAmD;AACnD,mCAAqD;AAKrD,0CAA6D;AAC7D,oCAAiD;AACjD,0CAA8C;AAC9C,iCAAgC;AAChC,uCAA0D;AAEnD,IAAM,mBAAmB,GAAG,UAAO,EAQd;QAP1B,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,eAAe,qBAAA,EACf,KAAK,WAAA,EACG,cAAc,YAAA,EACtB,YAAY,kBAAA,EACZ,uBAA+B,EAA/B,eAAe,mBAAG,KAAK,CAAC,OAAO,KAAA;;;;;;wBAEf,qBAAM,CAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;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,EAAA;;oBATK,MAAM,GAAG,SASd;oBAED,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAA,EAAE,CAAC;wBAClB,sBAAO;gCACL,eAAe,EAAE,IAAI;6BACtB,EAAC;oBACJ,CAAC;;;;oBAGO,uBAAuB,GAAG,IAAA,mCAA0B,GAAE,CAAC;oBAC7D,qBAAM,uBAAuB,CAAC,sBAAsB,CAClD,eAAe,EACf,MAAM,CAAC,IAAI,EACX,iBAAiB,EACjB,cAAc,EACd,sBAAsB,CAAC,OAAO,EAC9B,YAAY,CACb,EAAA;;oBAPD,SAOC,CAAC;;;;oBAEF,OAAO,CAAC,GAAG,CAAC,+CAA+C,EAAE,OAAK,CAAC,CAAC;;wBAGtE,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;;CACH,CAAC;AAhFW,QAAA,mBAAmB,uBAgF9B","sourcesContent":["import {\n getCurrentTimestampInSeconds,\n scale,\n ReyaChainId,\n getTokenInfoByAddress,\n} from '@reyaxyz/common';\nimport { ContractType, getAddress } from '@reyaxyz/common';\nimport { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';\nimport { signCoreCommands } from '@reyaxyz/common';\nimport { encodeWithdrawMAAndBridge } from './encode';\nimport {\n WithdrawMAAndBridgeParams,\n WithdrawMAAndBridgeParamsResult,\n} from './types';\nimport { BRIDGE_DEADLINE_IN_SECONDS } from '@reyaxyz/common';\nimport { encodeSingleWithdraw } from '../encode';\nimport { MultiAction } from '@reyaxyz/common';\nimport { ethers } from 'ethers';\nimport { getTransactionModuleClient } from '../../config';\n\nexport const withdrawMAAndBridge = async ({\n signer,\n moneyInOutChainId,\n marginAccountId,\n owner,\n amount: unscaledAmount,\n tokenAddress,\n receiverAddress = owner.address,\n}: WithdrawMAAndBridgeParams): Promise<WithdrawMAAndBridgeParamsResult> => {\n const network = await signer.provider?.getNetwork();\n const reyaChainId: ReyaChainId = Number(network?.chainId);\n\n const corePeripheryTokenInfo = getTokenInfoByAddress(tokenAddress);\n\n const multiAction = new MultiAction();\n encodeSingleWithdraw(\n corePeripheryTokenInfo.address,\n scale(corePeripheryTokenInfo.decimals)(unscaledAmount),\n multiAction,\n );\n\n const socketMsgGasLimit = BigInt('10000000');\n const eip712Signature = await signCoreCommands(\n signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n marginAccountId,\n multiAction.commands,\n owner.coreSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode(\n ['address', 'uint256', 'uint256'],\n [receiverAddress, moneyInOutChainId, socketMsgGasLimit],\n ),\n );\n\n const { calldata: data, value } = encodeWithdrawMAAndBridge(\n marginAccountId,\n corePeripheryTokenInfo.address,\n scale(corePeripheryTokenInfo.decimals)(unscaledAmount),\n eip712Signature,\n socketMsgGasLimit,\n moneyInOutChainId,\n receiverAddress,\n );\n\n const result = await signAndBroadcastTransaction(\n signer,\n data,\n value,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n {\n destinationType: 'account',\n },\n );\n\n if (!result?.hash) {\n return {\n transactionHash: null,\n };\n }\n\n try {\n const transactionModuleClient = getTransactionModuleClient();\n await transactionModuleClient.pushPendingTransaction(\n marginAccountId,\n result.hash,\n moneyInOutChainId,\n unscaledAmount,\n corePeripheryTokenInfo.address,\n 'withdrawal',\n );\n } catch (error) {\n console.log('Error persisting pending withdraw transaction', error);\n }\n\n return {\n transactionHash: result?.hash || null,\n };\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Address, RestClient, ServiceConfig } from '@reyaxyz/common';
2
2
  export type BroadcastTransactionMetadata = {
3
3
  accountName?: string;
4
+ destinationType?: 'pool' | 'account';
4
5
  };
5
6
  export type TxData = {
6
7
  to: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACV,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,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;AAEF,KAAK,cAAc,GAAG;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,kBAAkB,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,4BAA4B;gBAIX,MAAM;;;IAW7B,sBAAsB,CAC1B,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM;oBAGmB,OAAO;;CAYzC;AAED,qBAAa,gBAAiB,SAAQ,UAAU;IACxC,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASpE;AAYD,eAAO,MAAM,iBAAiB,QAAO,aAAa,CAAC,aAAa,CAE/D,CAAC;AAEF,eAAO,MAAM,YAAY,gBACV,aAAa,CAAC,aAAa,CAAC,KACxC,IAKF,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,gBAI5C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACV,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,kBAAkB,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,4BAA4B;gBAIX,MAAM;;;IAW7B,sBAAsB,CAC1B,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM;oBAGmB,OAAO;;CAYzC;AAED,qBAAa,gBAAiB,SAAQ,UAAU;IACxC,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASpE;AAYD,eAAO,MAAM,iBAAiB,QAAO,aAAa,CAAC,aAAa,CAE/D,CAAC;AAEF,eAAO,MAAM,YAAY,gBACV,aAAa,CAAC,aAAa,CAAC,KACxC,IAKF,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,gBAI5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withdrawPassivePoolAndBridge.d.ts","sourceRoot":"/","sources":["services/lp/withdrawPassivePoolAndBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,4BAA4B,WAC/B,kCAAkC,KACzC,QAAQ,kCAAkC,CAgD5C,CAAC"}
1
+ {"version":3,"file":"withdrawPassivePoolAndBridge.d.ts","sourceRoot":"/","sources":["services/lp/withdrawPassivePoolAndBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,4BAA4B,WAC/B,kCAAkC,KACzC,QAAQ,kCAAkC,CAmD5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withdrawMAAndBridge.d.ts","sourceRoot":"/","sources":["services/margin-accounts/withdrawMAAndBridge.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,mBAAmB,kHAQ7B,yBAAyB,KAAG,QAAQ,+BAA+B,CAsErE,CAAC"}
1
+ {"version":3,"file":"withdrawMAAndBridge.d.ts","sourceRoot":"/","sources":["services/margin-accounts/withdrawMAAndBridge.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,mBAAmB,kHAQ7B,yBAAyB,KAAG,QAAQ,+BAA+B,CAwErE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.83.2",
3
+ "version": "0.85.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -34,5 +34,5 @@
34
34
  "ethers": "6.9.0"
35
35
  },
36
36
  "packageManager": "pnpm@8.3.1",
37
- "gitHead": "b1b7a94c5e83b36b298a4c6a5f55be882a12345a"
37
+ "gitHead": "3bb30aabf91c145cb821b63adc0989e2f770fcbc"
38
38
  }
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  export type BroadcastTransactionMetadata = {
9
9
  accountName?: string;
10
+ destinationType?: 'pool' | 'account';
10
11
  };
11
12
 
12
13
  export type TxData = {
@@ -11,8 +11,8 @@ import {
11
11
  ContractType,
12
12
  getAddress,
13
13
  BRIDGE_DEADLINE_IN_SECONDS,
14
- executeTransaction,
15
14
  } from '@reyaxyz/common';
15
+ import { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';
16
16
 
17
17
  export const withdrawPassivePoolAndBridge = async (
18
18
  params: WithdrawPassivePoolAndBridgeParams,
@@ -53,12 +53,15 @@ export const withdrawPassivePoolAndBridge = async (
53
53
  params.owner.address,
54
54
  );
55
55
 
56
- const result = await executeTransaction(
56
+ const result = await signAndBroadcastTransaction(
57
57
  params.signer,
58
58
  data,
59
59
  value,
60
60
  reyaChainId,
61
61
  ContractType.PERIPHERY_PROXY,
62
+ {
63
+ destinationType: 'pool',
64
+ },
62
65
  );
63
66
 
64
67
  return {
@@ -70,7 +70,9 @@ export const withdrawMAAndBridge = async ({
70
70
  value,
71
71
  reyaChainId,
72
72
  ContractType.PERIPHERY_PROXY,
73
- {},
73
+ {
74
+ destinationType: 'account',
75
+ },
74
76
  );
75
77
 
76
78
  if (!result?.hash) {