@reyaxyz/sdk 0.128.4 → 0.128.6

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/README.md CHANGED
@@ -6,5 +6,5 @@
6
6
 
7
7
  | Statements | Branches | Functions | Lines |
8
8
  | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
- | ![Statements](https://img.shields.io/badge/statements-7.99%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-3.79%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-3.37%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-7.69%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-7.98%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-3.7%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-3.37%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-7.67%25-red.svg?style=flat) |
10
10
 
@@ -60,10 +60,12 @@ var TransactionModule = /** @class */ (function (_super) {
60
60
  }
61
61
  TransactionModule.prototype.executeTransaction = function (txData, contractAddress, metadata) {
62
62
  return __awaiter(this, void 0, void 0, function () {
63
- var uri;
63
+ var isReyaExecutorEnabled, uri;
64
64
  return __generator(this, function (_a) {
65
- uri = "/api/transaction-gelato/executeGelato";
66
- // const uri = `/api/transaction/execute`; //switch between Gelato and internal relayer
65
+ isReyaExecutorEnabled = process.env.IS_REYA_EXECUTOR_ENABLED === 'true' || false;
66
+ uri = isReyaExecutorEnabled
67
+ ? '/api/transaction-gelato/executeReya'
68
+ : '/api/transaction-gelato/executeGelato';
67
69
  return [2 /*return*/, this.post(uri, {}, {
68
70
  txData: txData,
69
71
  contractAddress: contractAddress,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CA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,WAAW,CACvC,CAAC;AAEF,IAAI,MAAqB,CAAC;AAEnB,IAAM,YAAY,GAAG;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF,gCAAgC;AACzB,IAAM,YAAY,GAAG,UAC1B,WAAyC;IAEzC,MAAM,GAAG,IAAA,2BAAkB,EAAC,WAAW,CAAC,CAAC;IACzC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9D,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;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;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 {\n RestClient,\n ServiceConfig,\n TransactionExecutionMetadata,\n TransactionExecutionOutput,\n SpotMarketEntity,\n CollateralWithHaircut,\n getApiClientConfig,\n} from '@reyaxyz/common';\n\nexport type TxData = {\n to: string;\n data: string;\n};\n\nexport class TransactionModule extends RestClient {\n async executeTransaction(\n txData: TxData,\n contractAddress: string,\n metadata: TransactionExecutionMetadata,\n ) {\n const uri = `/api/transaction-gelato/executeGelato`;\n // const uri = `/api/transaction/execute`; //switch between Gelato and internal relayer\n return this.post<TransactionExecutionOutput>(\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 GeneralRestModule extends RestClient {\n async getSpotMarkets(): Promise<SpotMarketEntity[]> {\n return this.get<SpotMarketEntity[]>('/api/spot-markets');\n }\n\n async getCollateralInfo(): Promise<CollateralWithHaircut[]> {\n return this.get<CollateralWithHaircut[]>(\n `/api/tokens/available-collaterals/excluding-rusd/${false}`,\n );\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n getApiClientConfig('test').apiEndpoint,\n);\n\nlet generalRestModule: GeneralRestModule = new GeneralRestModule(\n getApiClientConfig('test').apiEndpoint,\n);\n\nlet config: ServiceConfig;\n\nexport const getSdkConfig = (): ServiceConfig => {\n return config;\n};\n\n// Function to configure the SDK\nexport const configureSDK = (\n environment: ServiceConfig['environment'],\n): void => {\n config = getApiClientConfig(environment);\n transactionModule = new TransactionModule(config.apiEndpoint);\n generalRestModule = new GeneralRestModule(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 getGeneralRestModuleClient = (): GeneralRestModule => {\n if (!transactionModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return generalRestModule;\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAQyB;AAOzB;IAAuC,qCAAU;IAAjD;;IA4CA,CAAC;IA3CO,8CAAkB,GAAxB,UACE,MAAc,EACd,eAAuB,EACvB,QAAsC;;;;gBAEhC,qBAAqB,GACzB,OAAO,CAAC,G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AAEF,IAAI,MAAqB,CAAC;AAEnB,IAAM,YAAY,GAAG;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF,gCAAgC;AACzB,IAAM,YAAY,GAAG,UAC1B,WAAyC;IAEzC,MAAM,GAAG,IAAA,2BAAkB,EAAC,WAAW,CAAC,CAAC;IACzC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9D,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;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;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 {\n RestClient,\n ServiceConfig,\n TransactionExecutionMetadata,\n TransactionExecutionOutput,\n SpotMarketEntity,\n CollateralWithHaircut,\n getApiClientConfig,\n} from '@reyaxyz/common';\n\nexport type TxData = {\n to: string;\n data: string;\n};\n\nexport class TransactionModule extends RestClient {\n async executeTransaction(\n txData: TxData,\n contractAddress: string,\n metadata: TransactionExecutionMetadata,\n ) {\n const isReyaExecutorEnabled =\n process.env.IS_REYA_EXECUTOR_ENABLED === 'true' || false;\n\n const uri = isReyaExecutorEnabled\n ? '/api/transaction-gelato/executeReya'\n : '/api/transaction-gelato/executeGelato';\n return this.post<TransactionExecutionOutput>(\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 GeneralRestModule extends RestClient {\n async getSpotMarkets(): Promise<SpotMarketEntity[]> {\n return this.get<SpotMarketEntity[]>('/api/spot-markets');\n }\n\n async getCollateralInfo(): Promise<CollateralWithHaircut[]> {\n return this.get<CollateralWithHaircut[]>(\n `/api/tokens/available-collaterals/excluding-rusd/${false}`,\n );\n }\n}\n\n// Internal state\nlet transactionModule: TransactionModule = new TransactionModule(\n getApiClientConfig('test').apiEndpoint,\n);\n\nlet generalRestModule: GeneralRestModule = new GeneralRestModule(\n getApiClientConfig('test').apiEndpoint,\n);\n\nlet config: ServiceConfig;\n\nexport const getSdkConfig = (): ServiceConfig => {\n return config;\n};\n\n// Function to configure the SDK\nexport const configureSDK = (\n environment: ServiceConfig['environment'],\n): void => {\n config = getApiClientConfig(environment);\n transactionModule = new TransactionModule(config.apiEndpoint);\n generalRestModule = new GeneralRestModule(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 getGeneralRestModuleClient = (): GeneralRestModule => {\n if (!transactionModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return generalRestModule;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,4BAA4B,EAC5B,0BAA0B,EAC1B,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,MAAM,GAAG;IACnB,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MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM;oBAGmB,OAAO;;CAYzC;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,cAAc,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI7C,iBAAiB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAK5D;AAaD,eAAO,MAAM,YAAY,QAAO,aAE/B,CAAC;AAGF,eAAO,MAAM,YAAY,gBACV,aAAa,CAAC,aAAa,CAAC,KACxC,IAIF,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.128.4",
3
+ "version": "0.128.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -29,11 +29,11 @@
29
29
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
30
30
  },
31
31
  "dependencies": {
32
- "@reyaxyz/common": "0.268.1",
32
+ "@reyaxyz/common": "0.268.2",
33
33
  "axios": "^1.6.2",
34
34
  "bignumber.js": "^9.1.2",
35
35
  "ethers": "6.9.0"
36
36
  },
37
37
  "packageManager": "pnpm@8.3.1",
38
- "gitHead": "1fb9e481c85a4c2b959e8a7e293fbb2edf37944a"
38
+ "gitHead": "ee6eba8d9d1ce053554deefdf5d0f53cc34d8b29"
39
39
  }
@@ -19,8 +19,12 @@ export class TransactionModule extends RestClient {
19
19
  contractAddress: string,
20
20
  metadata: TransactionExecutionMetadata,
21
21
  ) {
22
- const uri = `/api/transaction-gelato/executeGelato`;
23
- // const uri = `/api/transaction/execute`; //switch between Gelato and internal relayer
22
+ const isReyaExecutorEnabled =
23
+ process.env.IS_REYA_EXECUTOR_ENABLED === 'true' || false;
24
+
25
+ const uri = isReyaExecutorEnabled
26
+ ? '/api/transaction-gelato/executeReya'
27
+ : '/api/transaction-gelato/executeGelato';
24
28
  return this.post<TransactionExecutionOutput>(
25
29
  uri,
26
30
  {},