@reyaxyz/sdk 0.106.3 → 0.106.4
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
CHANGED
|
@@ -128,7 +128,7 @@ var ApiInteractionsModule = /** @class */ (function (_super) {
|
|
|
128
128
|
signerWallet: signerWallet,
|
|
129
129
|
nonce: nonce,
|
|
130
130
|
signature: signature,
|
|
131
|
-
status: common_1.StopLossOrderStatus.
|
|
131
|
+
status: common_1.StopLossOrderStatus.PENDING,
|
|
132
132
|
})];
|
|
133
133
|
});
|
|
134
134
|
});
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CASyB;AAYzB;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;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qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACxE,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB;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,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;AAEK,IAAM,wBAAwB,GAAG;IACtC,IAAI,CAAC,qBAAqB;QACxB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC;AAJW,QAAA,wBAAwB,4BAInC","sourcesContent":["import {\n Address,\n API_CLIENT_CONFIGS,\n RestClient,\n ServiceConfig,\n TransactionExecutionMetadata,\n TransactionExecutionOutput,\n StopLossOrderStatus,\n StopLossOrder,\n} from '@reyaxyz/common';\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: 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 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\nexport class ApiInteractionsModule extends RestClient {\n async createSLOrder(\n accountId: number,\n marketId: number,\n isLong: boolean,\n stopPrice: number,\n signerWallet: string,\n nonce: string,\n signature: string,\n ) {\n const uri = `/api/conditional-orders/sl/create-order`;\n return this.post<StopLossOrder>(\n uri,\n {},\n {\n accountId: accountId,\n marketId: marketId,\n isLong: isLong,\n stopPrice: stopPrice,\n signerWallet: signerWallet,\n nonce: nonce,\n signature: signature,\n status: StopLossOrderStatus.PENDING,\n },\n );\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);\nlet apiInteractionsModule: ApiInteractionsModule = new ApiInteractionsModule(\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 apiInteractionsModule = new ApiInteractionsModule(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\nexport const getApiInteractionsModule = (): ApiInteractionsModule => {\n if (!apiInteractionsModule)\n throw new Error('SDK is not configured! Call configureSDK()');\n return apiInteractionsModule;\n};\n"]}
|
|
@@ -17,7 +17,7 @@ export declare class AlphaTermsModule extends RestClient {
|
|
|
17
17
|
registerAlphaSignature(params: AlphaTermsData): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
export declare class ApiInteractionsModule extends RestClient {
|
|
20
|
-
createSLOrder(accountId: number, marketId: number, isLong: boolean, stopPrice: number, signerWallet: string, nonce:
|
|
20
|
+
createSLOrder(accountId: number, marketId: number, isLong: boolean, stopPrice: number, signerWallet: string, nonce: string, signature: string): Promise<StopLossOrder>;
|
|
21
21
|
}
|
|
22
22
|
export declare const getSdkEnvironment: () => ServiceConfig['environment'];
|
|
23
23
|
export declare const configureSDK: (environment: ServiceConfig['environment']) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/sdk",
|
|
3
|
-
"version": "0.106.
|
|
3
|
+
"version": "0.106.4",
|
|
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.155.
|
|
32
|
+
"@reyaxyz/common": "0.155.3",
|
|
33
33
|
"bignumber.js": "^9.1.2",
|
|
34
34
|
"ethers": "6.9.0"
|
|
35
35
|
},
|
|
36
36
|
"packageManager": "pnpm@8.3.1",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d588a7b45d04c349ac09d10aff233fbc15c0833e"
|
|
38
38
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -80,7 +80,7 @@ export class ApiInteractionsModule extends RestClient {
|
|
|
80
80
|
isLong: boolean,
|
|
81
81
|
stopPrice: number,
|
|
82
82
|
signerWallet: string,
|
|
83
|
-
nonce:
|
|
83
|
+
nonce: string,
|
|
84
84
|
signature: string,
|
|
85
85
|
) {
|
|
86
86
|
const uri = `/api/conditional-orders/sl/create-order`;
|
|
@@ -95,7 +95,7 @@ export class ApiInteractionsModule extends RestClient {
|
|
|
95
95
|
signerWallet: signerWallet,
|
|
96
96
|
nonce: nonce,
|
|
97
97
|
signature: signature,
|
|
98
|
-
status: StopLossOrderStatus.
|
|
98
|
+
status: StopLossOrderStatus.PENDING,
|
|
99
99
|
},
|
|
100
100
|
);
|
|
101
101
|
}
|