@reyaxyz/api-sdk 0.164.1 → 0.164.3
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/clients/modules/deposit-existing-MA.simulation/index.js +2 -4
- package/dist/clients/modules/deposit-existing-MA.simulation/index.js.map +1 -1
- package/dist/clients/modules/deposit-passive-pool.simulation/index.js +2 -4
- package/dist/clients/modules/deposit-passive-pool.simulation/index.js.map +1 -1
- package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts.map +1 -1
- package/dist/types/clients/modules/deposit-passive-pool.simulation/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/clients/modules/deposit-existing-MA.simulation/index.ts +2 -5
- package/src/clients/modules/deposit-passive-pool.simulation/index.ts +2 -5
|
@@ -92,11 +92,9 @@ var DepositExistingMASimulationClient = /** @class */ (function (_super) {
|
|
|
92
92
|
if (!socketDepositFeesEntry) {
|
|
93
93
|
throw new Error("Socket deposit fees for chain ".concat(moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
|
|
94
94
|
}
|
|
95
|
-
// add 10% buffer, will be used in deposit transaction
|
|
96
|
-
var fees = (0, common_1.applySocketFeeBuffer)(socketDepositFeesEntry.fees);
|
|
97
95
|
var socketDepositFees = {
|
|
98
|
-
fees: fees,
|
|
99
|
-
feesInUnderlyingToken: (0, common_1.descale)(18)(fees),
|
|
96
|
+
fees: socketDepositFeesEntry.fees,
|
|
97
|
+
feesInUnderlyingToken: (0, common_1.descale)(18)(socketDepositFeesEntry.fees),
|
|
100
98
|
underlyingTokenName: (0, common_2.getNativeToken)(moneyInOutChainId),
|
|
101
99
|
};
|
|
102
100
|
var simulateEditCollateralEntity = this.editCollateralClient.simulate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;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IAAI,KAAK,CACb,wCAAiC,iBAAiB,wBAAc,SAAS,CAAC,IAAI,iGAA8F,CAC7K,CAAC;QACJ,CAAC;QACD,IAAM,iBAAiB,GAAsB;YAC3C,IAAI,EAAE,sBAAsB,CAAC,IAAI;YACjC,qBAAqB,EAAE,IAAA,gBAAO,EAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAC/D,mBAAmB,EAAE,IAAA,uBAAc,EAAC,iBAAiB,CAAC;SACvD,CAAC;QAEF,IAAM,4BAA4B,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC;YACtE,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,iBAAiB;SACrC,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SAClE,CAAC;IACJ,CAAC;IACH,wCAAC;AAAD,CAAC,AAjED,CAA+D,mBAAU,GAiExE","sourcesContent":["import {\n descale,\n getSocketBridgeTime,\n getTokenInfoByAddress,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesEntry,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n DepositExistingMASimulationLoadDataParams,\n DepositExistingMASimulationSimulateParams,\n SimulateDepositExistingMAEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositExistingMASimulationClient extends RestClient {\n private editCollateralClient: EditCollateralClient;\n private socketDepositFeesList: SocketDepositFeesEntry[] = [];\n\n constructor(\n editCollateralClient: EditCollateralClient,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.editCollateralClient = editCollateralClient;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: DepositExistingMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n\n this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositExistingMASimulationSimulateParams,\n ): SimulateDepositExistingMAEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getTokenInfoByAddress(\n params.tokenAddress,\n moneyInOutChainId,\n );\n const socketDepositFeesEntry = this.socketDepositFeesList.find(\n (socketDepositFeesEntry) =>\n socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketDepositFeesEntry) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDepositFeesEntry.fees,\n feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n };\n }\n}\n"]}
|
|
@@ -87,11 +87,9 @@ var DepositPassivePoolSimulationClient = /** @class */ (function (_super) {
|
|
|
87
87
|
if (!socketDepositFeesEntry) {
|
|
88
88
|
throw new Error("Socket deposit fees for chain ".concat(moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
|
|
89
89
|
}
|
|
90
|
-
// add 10% buffer, will be used in deposit transaction
|
|
91
|
-
var fees = (0, common_1.applySocketFeeBuffer)(socketDepositFeesEntry.fees);
|
|
92
90
|
var socketDepositFees = {
|
|
93
|
-
fees: fees,
|
|
94
|
-
feesInUnderlyingToken: (0, common_1.descale)(18)(fees),
|
|
91
|
+
fees: socketDepositFeesEntry.fees,
|
|
92
|
+
feesInUnderlyingToken: (0, common_1.descale)(18)(socketDepositFeesEntry.fees),
|
|
95
93
|
underlyingTokenName: (0, common_2.getNativeToken)(moneyInOutChainId),
|
|
96
94
|
};
|
|
97
95
|
var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAOyB;AAKzB,0CAAiD;AAEjD;IAAgE,sDAAU;IAGxE,4CAAY,IAAY,EAAE,UAA0B;QAClD,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAHlB,2BAAqB,GAA6B,EAAE,CAAC;;IAI7D,CAAC;IAED,wDAAwD;IAClD,gDAAG,GAAT;;;;;;wBACE,KAAA,IAAI,CAAA;wBAAyB,qBAAM,IAAI,CAAC,GAAG,CACzC,0BAA0B,CAC3B,EAAA;;wBAFD,GAAK,qBAAqB,GAAG,SAE5B,CAAC;;;;;KACH;IAED,+DAA+D;IAC/D,qDAAQ,GAAR,UACE,MAAkD;QAElD,IAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,iBAAiB,CAAC,CAAC;QAChE,IAAM,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC5D,UAAC,sBAAsB;YACrB,OAAA,sBAAsB,CAAC,iBAAiB,KAAK,iBAAiB;gBAC9D,sBAAsB,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI;QADnD,CACmD,CACtD,CAAC;QACF,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,wCAAiC,iBAAiB,wBAAc,SAAS,CAAC,IAAI,iGAA8F,CAC7K,CAAC;QACJ,CAAC;QACD,IAAM,iBAAiB,GAAsB;YAC3C,IAAI,EAAE,sBAAsB,CAAC,IAAI;YACjC,qBAAqB,EAAE,IAAA,gBAAO,EAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAC/D,mBAAmB,EAAE,IAAA,uBAAc,EAAC,iBAAiB,CAAC;SACvD,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,iBAAiB;SACrC,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,cAAc;SAC/B,CAAC;IACJ,CAAC;IACH,yCAAC;AAAD,CAAC,AA7CD,CAAgE,mBAAU,GA6CzE","sourcesContent":["import {\n descale,\n getRUSDUnderlyingTokenInfo,\n getSocketBridgeTime,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesEntry,\n} from '@reyaxyz/common';\nimport {\n DepositPassivePoolSimulationSimulateParams,\n SimulateDepositPassivePoolEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositPassivePoolSimulationClient extends RestClient {\n private socketDepositFeesList: SocketDepositFeesEntry[] = [];\n\n constructor(host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n }\n\n // Method to asynchronously load data based on accountId\n async arm(): Promise<void> {\n this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositPassivePoolSimulationSimulateParams,\n ): SimulateDepositPassivePoolEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getRUSDUnderlyingTokenInfo(moneyInOutChainId);\n const socketDepositFeesEntry = this.socketDepositFeesList.find(\n (socketDepositFeesEntry) =>\n socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketDepositFeesEntry) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDepositFeesEntry.fees,\n feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,iCAAkC,SAAQ,UAAU;IACvE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAAgC;gBAG3D,oBAAoB,EAAE,oBAAoB,EAC1C,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtB,GAAG,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3E,QAAQ,CACN,MAAM,EAAE,yCAAyC,GAChD,+BAA+B;CAsCnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,UAAU;IACxE,OAAO,CAAC,qBAAqB,CAAgC;gBAEjD,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,QAAQ,CACN,MAAM,EAAE,0CAA0C,GACjD,gCAAgC;CA4BpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.164.
|
|
3
|
+
"version": "0.164.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@reyaxyz/common": "0.
|
|
36
|
+
"@reyaxyz/common": "0.338.0",
|
|
37
37
|
"@simplewebauthn/types": "10.0.0",
|
|
38
38
|
"bignumber.js": "9.1.2",
|
|
39
39
|
"ethers": "6.9.0",
|
|
40
40
|
"isomorphic-ws": "5.0.0"
|
|
41
41
|
},
|
|
42
42
|
"packageManager": "pnpm@8.3.1",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "a912562d273b0bad9943e38ad92951eb770d7c46",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@reyaxyz/database": "0.156.
|
|
45
|
+
"@reyaxyz/database": "0.156.22"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
RestClient,
|
|
6
6
|
SocketDepositFees,
|
|
7
7
|
SocketDepositFeesEntry,
|
|
8
|
-
applySocketFeeBuffer,
|
|
9
8
|
} from '@reyaxyz/common';
|
|
10
9
|
import EditCollateralClient from '../edit-collateral.simulation';
|
|
11
10
|
import {
|
|
@@ -58,11 +57,9 @@ export default class DepositExistingMASimulationClient extends RestClient {
|
|
|
58
57
|
`Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
|
|
59
58
|
);
|
|
60
59
|
}
|
|
61
|
-
// add 10% buffer, will be used in deposit transaction
|
|
62
|
-
const fees = applySocketFeeBuffer(socketDepositFeesEntry.fees);
|
|
63
60
|
const socketDepositFees: SocketDepositFees = {
|
|
64
|
-
fees,
|
|
65
|
-
feesInUnderlyingToken: descale(18)(fees),
|
|
61
|
+
fees: socketDepositFeesEntry.fees,
|
|
62
|
+
feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),
|
|
66
63
|
underlyingTokenName: getNativeToken(moneyInOutChainId),
|
|
67
64
|
};
|
|
68
65
|
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
RestClient,
|
|
6
6
|
SocketDepositFees,
|
|
7
7
|
SocketDepositFeesEntry,
|
|
8
|
-
applySocketFeeBuffer,
|
|
9
8
|
} from '@reyaxyz/common';
|
|
10
9
|
import {
|
|
11
10
|
DepositPassivePoolSimulationSimulateParams,
|
|
@@ -43,11 +42,9 @@ export default class DepositPassivePoolSimulationClient extends RestClient {
|
|
|
43
42
|
`Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
|
|
44
43
|
);
|
|
45
44
|
}
|
|
46
|
-
// add 10% buffer, will be used in deposit transaction
|
|
47
|
-
const fees = applySocketFeeBuffer(socketDepositFeesEntry.fees);
|
|
48
45
|
const socketDepositFees: SocketDepositFees = {
|
|
49
|
-
fees,
|
|
50
|
-
feesInUnderlyingToken: descale(18)(fees),
|
|
46
|
+
fees: socketDepositFeesEntry.fees,
|
|
47
|
+
feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),
|
|
51
48
|
underlyingTokenName: getNativeToken(moneyInOutChainId),
|
|
52
49
|
};
|
|
53
50
|
|