@myx-trade/sdk 0.1.128 → 0.1.130
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/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +42 -28
- package/dist/index.mjs +42 -28
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1334,7 +1334,7 @@ declare class Utils {
|
|
|
1334
1334
|
code: number;
|
|
1335
1335
|
message: any;
|
|
1336
1336
|
}>;
|
|
1337
|
-
getUserTradingFeeRate(assetClass: number
|
|
1337
|
+
getUserTradingFeeRate(assetClass: number): Promise<{
|
|
1338
1338
|
code: number;
|
|
1339
1339
|
data: {
|
|
1340
1340
|
takerFeeRate: any;
|
|
@@ -1436,9 +1436,8 @@ declare class Account {
|
|
|
1436
1436
|
/**
|
|
1437
1437
|
* get tradable amount
|
|
1438
1438
|
*/
|
|
1439
|
-
getTradableAmount({ poolId
|
|
1439
|
+
getTradableAmount({ poolId }: {
|
|
1440
1440
|
poolId: string;
|
|
1441
|
-
chainId: number;
|
|
1442
1441
|
}): Promise<{
|
|
1443
1442
|
code: number;
|
|
1444
1443
|
data: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1334,7 +1334,7 @@ declare class Utils {
|
|
|
1334
1334
|
code: number;
|
|
1335
1335
|
message: any;
|
|
1336
1336
|
}>;
|
|
1337
|
-
getUserTradingFeeRate(assetClass: number
|
|
1337
|
+
getUserTradingFeeRate(assetClass: number): Promise<{
|
|
1338
1338
|
code: number;
|
|
1339
1339
|
data: {
|
|
1340
1340
|
takerFeeRate: any;
|
|
@@ -1436,9 +1436,8 @@ declare class Account {
|
|
|
1436
1436
|
/**
|
|
1437
1437
|
* get tradable amount
|
|
1438
1438
|
*/
|
|
1439
|
-
getTradableAmount({ poolId
|
|
1439
|
+
getTradableAmount({ poolId }: {
|
|
1440
1440
|
poolId: string;
|
|
1441
|
-
chainId: number;
|
|
1442
1441
|
}): Promise<{
|
|
1443
1442
|
code: number;
|
|
1444
1443
|
data: {
|
package/dist/index.js
CHANGED
|
@@ -1822,7 +1822,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1822
1822
|
// package.json
|
|
1823
1823
|
var package_default = {
|
|
1824
1824
|
name: "@myx-trade/sdk",
|
|
1825
|
-
version: "0.1.
|
|
1825
|
+
version: "0.1.130",
|
|
1826
1826
|
private: false,
|
|
1827
1827
|
publishConfig: {
|
|
1828
1828
|
access: "public"
|
|
@@ -11461,22 +11461,26 @@ var customErrorMapping = {
|
|
|
11461
11461
|
"0xba767932": "ConvertAmountMismatch(uint256,uint256)",
|
|
11462
11462
|
"0xd93c0665": "EnforcedPause()",
|
|
11463
11463
|
"0x8dfc202b": "ExpectedPause()",
|
|
11464
|
+
"0x059e2f49": "InRewindMode()",
|
|
11465
|
+
"0x42301c23": "InsufficientOutputAmount()",
|
|
11466
|
+
"0x8637dfc0": "NotInRewindMode()",
|
|
11464
11467
|
"0x4578ddb8": "OnlyRelayer()",
|
|
11465
11468
|
"0x1e4fbdf7": "OwnableInvalidOwner(address)",
|
|
11466
11469
|
"0x118cdaa7": "OwnableUnauthorizedAccount(address)",
|
|
11467
11470
|
"0x3ee5aeb5": "ReentrancyGuardReentrantCall()",
|
|
11468
11471
|
"0x90b8ec18": "TransferFailed()",
|
|
11469
11472
|
"0xc6e8248a": "InsufficientSize()",
|
|
11470
|
-
"
|
|
11473
|
+
"0x700deaad": "InvalidADLPosition(OrderId,PositionId)",
|
|
11471
11474
|
"0x3385aa1f": "ExceedOrderSize(uint256)",
|
|
11472
11475
|
"0xc6c2b87b": "ExecutionFeeNotSupport(address)",
|
|
11473
|
-
"0xb07e3bc4": "InsufficientCollateral(
|
|
11476
|
+
"0xb07e3bc4": "InsufficientCollateral(uint256,uint256)",
|
|
11474
11477
|
"0x613970e0": "InvalidParameter()",
|
|
11475
11478
|
"0x27d08510": "NotActiveBroker(address)",
|
|
11476
11479
|
"0xf6412b5a": "NotOrderOwner()",
|
|
11477
11480
|
"0x70d645e3": "NotPositionOwner()",
|
|
11478
11481
|
"0xe75316c6": "OrderNotExist(OrderId)",
|
|
11479
11482
|
"0xba01b06f": "PoolNotActive(PoolId)",
|
|
11483
|
+
"0xddefae28": "AlreadyMinted()",
|
|
11480
11484
|
"0x64283d7b": "ERC721IncorrectOwner(address,uint256,address)",
|
|
11481
11485
|
"0x177e802f": "ERC721InsufficientApproval(address,uint256)",
|
|
11482
11486
|
"0xa9fbf51f": "ERC721InvalidApprover(address)",
|
|
@@ -11485,10 +11489,11 @@ var customErrorMapping = {
|
|
|
11485
11489
|
"0x64a0ae92": "ERC721InvalidReceiver(address)",
|
|
11486
11490
|
"0x73c6ac6e": "ERC721InvalidSender(address)",
|
|
11487
11491
|
"0x7e273289": "ERC721NonexistentToken(uint256)",
|
|
11488
|
-
"
|
|
11492
|
+
"0xb4762117": "ExceedMaxLeverage(PositionId)",
|
|
11489
11493
|
"0x29143a42": "ExceedPositionSize()",
|
|
11490
|
-
"
|
|
11491
|
-
"
|
|
11494
|
+
"0x8ea9158f": "InvalidPosition(PositionId)",
|
|
11495
|
+
"0xa5afd143": "PositionNotHealthy(PositionId,uint256)",
|
|
11496
|
+
"0xba0d3752": "PositionNotInitialized(PositionId)",
|
|
11492
11497
|
"0xc20f35b7": "UnderflowOI()",
|
|
11493
11498
|
"0xf4d678b8": "InsufficientBalance()",
|
|
11494
11499
|
"0x6aee3c1a": "InsufficientRiskReserves()",
|
|
@@ -11503,6 +11508,7 @@ var customErrorMapping = {
|
|
|
11503
11508
|
"0xc7544914": "ExceedDebt(uint256,uint256)",
|
|
11504
11509
|
"0xe7aa687a": "ExceedExchangeable()",
|
|
11505
11510
|
"0xdb42144d": "InsufficientBalance(address,uint256,uint256)",
|
|
11511
|
+
"0x5646203f": "InsufficientCollateral(PositionId,uint256)",
|
|
11506
11512
|
"0xf645eedf": "ECDSAInvalidSignature()",
|
|
11507
11513
|
"0xfce698f7": "ECDSAInvalidSignatureLength(uint256)",
|
|
11508
11514
|
"0xd78bce0c": "ECDSAInvalidSignatureS(bytes32)",
|
|
@@ -11523,11 +11529,10 @@ var customErrorMapping = {
|
|
|
11523
11529
|
"0xe079169e": "NotReachedPrice(OrderId,uint256,uint256,TriggerType)",
|
|
11524
11530
|
"0xc60eb335": "OnlyKeeper()",
|
|
11525
11531
|
"0xa8ce4432": "SafeCastOverflowedIntToUint(int256)",
|
|
11526
|
-
"
|
|
11527
|
-
"0xfda4bbac": "NotMeetEarlyCloseCriteria(PositionId)",
|
|
11532
|
+
"0x17229ec4": "NotMeetEarlyCloseCriteria(PositionId)",
|
|
11528
11533
|
"0x0dc149f0": "AlreadyInitialized()",
|
|
11529
11534
|
"0x7a5c919f": "InvalidRewindPrice()",
|
|
11530
|
-
"
|
|
11535
|
+
"0xc53f84e7": "PositionRemainsHealthy(PositionId)",
|
|
11531
11536
|
"0x230e8e43": "PoolNotInPreBenchState(PoolId)",
|
|
11532
11537
|
"0x664431a8": "NotAllowedTarget(address)",
|
|
11533
11538
|
"0x03357c6c": "ExceedsMaximumRelayFee()",
|
|
@@ -11535,6 +11540,8 @@ var customErrorMapping = {
|
|
|
11535
11540
|
"0x38802743": "InsufficientFeeAllowance(address,uint256,uint256)",
|
|
11536
11541
|
"0xd95b4ad5": "InsufficientFeeBalance(address,uint256,uint256)",
|
|
11537
11542
|
"0xa3972305": "MismatchedSender(address)",
|
|
11543
|
+
"0xc3b80e86": "RelayerRegistered(address)",
|
|
11544
|
+
"0xee0844a3": "RemoveRelayerFailed()",
|
|
11538
11545
|
"0xc583a8da": "IncorrectFee(uint256)",
|
|
11539
11546
|
"0x00bfc921": "InvalidPrice()",
|
|
11540
11547
|
"0x148cd0dd": "VerifyPriceFailed()",
|
|
@@ -11553,7 +11560,9 @@ var customErrorMapping = {
|
|
|
11553
11560
|
"0x7bd42a2e": "NotEmptyAddress()",
|
|
11554
11561
|
"0x6697b232": "AccessControlBadConfirmation()",
|
|
11555
11562
|
"0xe2517d3f": "AccessControlUnauthorizedAccount(address,bytes32)",
|
|
11563
|
+
"0x7c9a1cf9": "AlreadyVoted()",
|
|
11556
11564
|
"0x796ea3a6": "BondNotReleased()",
|
|
11565
|
+
"0xf38e5973": "CaseAppealNotFinished()",
|
|
11557
11566
|
"0x63d39157": "CaseCanNotAppeal()",
|
|
11558
11567
|
"0x1eaa4a59": "CaseDeadlineNotReached()",
|
|
11559
11568
|
"0xe6c67e3a": "CaseDeadlineReached()",
|
|
@@ -11565,17 +11574,16 @@ var customErrorMapping = {
|
|
|
11565
11574
|
"0xdcdedda9": "InvalidPoolToken()",
|
|
11566
11575
|
"0xc546bca4": "NotCaseRespondent(CaseId,address)",
|
|
11567
11576
|
"0x784fd7f1": "OnlyActiveValidator()",
|
|
11577
|
+
"0xc00ca938": "UnexpectedCaseState()",
|
|
11568
11578
|
"0xa9214540": "AlreadyClaimed(CaseId,address)",
|
|
11569
11579
|
"0xd4ac59c1": "InvalidAmount(CaseId,address)",
|
|
11570
11580
|
"0x7a6f5328": "MerkleTreeVerificationFailed(CaseId,address)",
|
|
11571
11581
|
"0x094a5cfe": "ReimbursementValidity(CaseId)",
|
|
11572
|
-
"
|
|
11573
|
-
"
|
|
11582
|
+
"0xb04111ef": "InsufficientFreeCollateral(PositionId,uint256)",
|
|
11583
|
+
"0x12f1b11a": "InsufficientLockedCollateral(PositionId,uint256)",
|
|
11574
11584
|
"0x6dfcc650": "SafeCastOverflowedUintDowncast(uint8,uint256)",
|
|
11575
11585
|
"0x1c151780": "ExceedMinOutput(uint256,uint256)",
|
|
11576
11586
|
"0xe1f0493d": "NotAllowedCaller(address)",
|
|
11577
|
-
"0x059e2f49": "InRewindMode()",
|
|
11578
|
-
"0x8637dfc0": "NotInRewindMode()",
|
|
11579
11587
|
"0xfb8f41b2": "ERC20InsufficientAllowance(address,uint256,uint256)",
|
|
11580
11588
|
"0xe450d38c": "ERC20InsufficientBalance(address,uint256,uint256)",
|
|
11581
11589
|
"0xe602df05": "ERC20InvalidApprover(address)",
|
|
@@ -11588,15 +11596,15 @@ var customErrorMapping = {
|
|
|
11588
11596
|
"0xb3512b0c": "InvalidShortString()",
|
|
11589
11597
|
"0x305a27a9": "StringTooLong(string)",
|
|
11590
11598
|
"0xfd0f789d": "ExceedMaxPriceDeviation()",
|
|
11591
|
-
"
|
|
11599
|
+
"0x18b88897": "InvalidUpdateFee()",
|
|
11592
11600
|
"0x19abf40e": "StalePrice()",
|
|
11593
11601
|
"0xe351cd13": "ExceedMaxExchangeableAmount()",
|
|
11594
11602
|
"0x15912a6f": "NotSupportVersion()",
|
|
11595
11603
|
"0xf1364a74": "ArrayEmpty()",
|
|
11596
11604
|
"0x15ed381d": "ExceedMaxProfit()",
|
|
11597
|
-
"0x42301c23": "InsufficientOutputAmount()",
|
|
11598
11605
|
"0x51aeee6c": "PoolNotExist(PoolId)",
|
|
11599
11606
|
"0x70f6c197": "InvalidQuoteTokenAddress()",
|
|
11607
|
+
"0x0b8457f4": "InvalidRatioParams()",
|
|
11600
11608
|
"0x29dae146": "MarketAlreadyExisted()",
|
|
11601
11609
|
"0x0e442a4a": "InvalidBaseToken()",
|
|
11602
11610
|
"0x24e219c7": "MarketNotExist(MarketId)",
|
|
@@ -11658,16 +11666,24 @@ async function getErrorTextFormError(error) {
|
|
|
11658
11666
|
const errorKey = Object.keys(customErrorMapping).find((k) => k.toLowerCase() === decodeErrorResult.selector.toLowerCase());
|
|
11659
11667
|
if (errorKey) {
|
|
11660
11668
|
return {
|
|
11661
|
-
error:
|
|
11669
|
+
error: {
|
|
11670
|
+
code: errorKey,
|
|
11671
|
+
message: customErrorMapping[errorKey]
|
|
11672
|
+
}
|
|
11662
11673
|
};
|
|
11663
11674
|
}
|
|
11664
11675
|
return {
|
|
11665
|
-
error:
|
|
11676
|
+
error: {
|
|
11677
|
+
code: error?.code,
|
|
11678
|
+
message: error?.reason || decodeErrorResult.reason || error.message
|
|
11679
|
+
}
|
|
11666
11680
|
};
|
|
11667
11681
|
}
|
|
11668
|
-
console.error(error);
|
|
11669
11682
|
return {
|
|
11670
|
-
error:
|
|
11683
|
+
error: {
|
|
11684
|
+
code: decodeErrorResult.type,
|
|
11685
|
+
message: decodeErrorResult.reason
|
|
11686
|
+
}
|
|
11671
11687
|
};
|
|
11672
11688
|
}
|
|
11673
11689
|
|
|
@@ -12219,6 +12235,7 @@ var getRewards = async (params) => {
|
|
|
12219
12235
|
gasLimit,
|
|
12220
12236
|
gasPrice
|
|
12221
12237
|
});
|
|
12238
|
+
console.log("pendingUserRebates base result:", request);
|
|
12222
12239
|
return request;
|
|
12223
12240
|
} catch (error) {
|
|
12224
12241
|
console.error(error);
|
|
@@ -14287,7 +14304,7 @@ var Order = class {
|
|
|
14287
14304
|
params.executionFeeToken,
|
|
14288
14305
|
params.collateralAmount
|
|
14289
14306
|
);
|
|
14290
|
-
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId
|
|
14307
|
+
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId });
|
|
14291
14308
|
const marginAccountBalance = marginAccountBalanceRes?.data;
|
|
14292
14309
|
if (marginAccountBalanceRes.code !== 0) {
|
|
14293
14310
|
return {
|
|
@@ -14326,7 +14343,6 @@ var Order = class {
|
|
|
14326
14343
|
};
|
|
14327
14344
|
const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
|
|
14328
14345
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
14329
|
-
this.logger.info("seamlessWallet-->", seamlessWallet);
|
|
14330
14346
|
if (config.seamlessMode && authorized && seamlessWallet) {
|
|
14331
14347
|
if (needsApproval) {
|
|
14332
14348
|
const approvalResult = await this.utils.approveAuthorization({
|
|
@@ -14335,13 +14351,11 @@ var Order = class {
|
|
|
14335
14351
|
amount: import_ethers24.ethers.MaxUint256.toString(),
|
|
14336
14352
|
signer: seamlessWallet
|
|
14337
14353
|
});
|
|
14338
|
-
this.logger.info("approvalResult-->", approvalResult);
|
|
14339
14354
|
if (approvalResult.code !== 0) {
|
|
14340
14355
|
throw new Error(approvalResult.message);
|
|
14341
14356
|
}
|
|
14342
14357
|
}
|
|
14343
14358
|
const isEnoughGas = await this.utils.checkSeamlessGas(params.address);
|
|
14344
|
-
this.logger.info("isEnoughGas-->", isEnoughGas);
|
|
14345
14359
|
if (!isEnoughGas) {
|
|
14346
14360
|
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
|
|
14347
14361
|
}
|
|
@@ -20069,11 +20083,11 @@ var Utils = class {
|
|
|
20069
20083
|
};
|
|
20070
20084
|
}
|
|
20071
20085
|
}
|
|
20072
|
-
async getUserTradingFeeRate(assetClass
|
|
20086
|
+
async getUserTradingFeeRate(assetClass) {
|
|
20073
20087
|
const config = this.configManager.getConfig();
|
|
20074
20088
|
const brokerAddress = config.brokerAddress;
|
|
20075
20089
|
try {
|
|
20076
|
-
const provider = await getJSONProvider(chainId);
|
|
20090
|
+
const provider = await getJSONProvider(config.chainId);
|
|
20077
20091
|
const brokerContract = new import_ethers25.ethers.Contract(
|
|
20078
20092
|
brokerAddress,
|
|
20079
20093
|
Broker_default,
|
|
@@ -20994,7 +21008,7 @@ var Account = class {
|
|
|
20994
21008
|
/**
|
|
20995
21009
|
* get tradable amount
|
|
20996
21010
|
*/
|
|
20997
|
-
async getTradableAmount({ poolId
|
|
21011
|
+
async getTradableAmount({ poolId }) {
|
|
20998
21012
|
const config = this.configManager.getConfig();
|
|
20999
21013
|
if (!config.signer) {
|
|
21000
21014
|
throw new MyxSDKError(
|
|
@@ -21002,8 +21016,8 @@ var Account = class {
|
|
|
21002
21016
|
"Invalid signer"
|
|
21003
21017
|
);
|
|
21004
21018
|
}
|
|
21005
|
-
const contractAddress = getContractAddressByChainId(chainId);
|
|
21006
|
-
const provider = await getJSONProvider(chainId);
|
|
21019
|
+
const contractAddress = getContractAddressByChainId(config.chainId);
|
|
21020
|
+
const provider = await getJSONProvider(config.chainId);
|
|
21007
21021
|
const accountContract = new import_ethers26.ethers.Contract(
|
|
21008
21022
|
contractAddress.Account,
|
|
21009
21023
|
Account_default,
|
package/dist/index.mjs
CHANGED
|
@@ -1732,7 +1732,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1732
1732
|
// package.json
|
|
1733
1733
|
var package_default = {
|
|
1734
1734
|
name: "@myx-trade/sdk",
|
|
1735
|
-
version: "0.1.
|
|
1735
|
+
version: "0.1.130",
|
|
1736
1736
|
private: false,
|
|
1737
1737
|
publishConfig: {
|
|
1738
1738
|
access: "public"
|
|
@@ -11371,22 +11371,26 @@ var customErrorMapping = {
|
|
|
11371
11371
|
"0xba767932": "ConvertAmountMismatch(uint256,uint256)",
|
|
11372
11372
|
"0xd93c0665": "EnforcedPause()",
|
|
11373
11373
|
"0x8dfc202b": "ExpectedPause()",
|
|
11374
|
+
"0x059e2f49": "InRewindMode()",
|
|
11375
|
+
"0x42301c23": "InsufficientOutputAmount()",
|
|
11376
|
+
"0x8637dfc0": "NotInRewindMode()",
|
|
11374
11377
|
"0x4578ddb8": "OnlyRelayer()",
|
|
11375
11378
|
"0x1e4fbdf7": "OwnableInvalidOwner(address)",
|
|
11376
11379
|
"0x118cdaa7": "OwnableUnauthorizedAccount(address)",
|
|
11377
11380
|
"0x3ee5aeb5": "ReentrancyGuardReentrantCall()",
|
|
11378
11381
|
"0x90b8ec18": "TransferFailed()",
|
|
11379
11382
|
"0xc6e8248a": "InsufficientSize()",
|
|
11380
|
-
"
|
|
11383
|
+
"0x700deaad": "InvalidADLPosition(OrderId,PositionId)",
|
|
11381
11384
|
"0x3385aa1f": "ExceedOrderSize(uint256)",
|
|
11382
11385
|
"0xc6c2b87b": "ExecutionFeeNotSupport(address)",
|
|
11383
|
-
"0xb07e3bc4": "InsufficientCollateral(
|
|
11386
|
+
"0xb07e3bc4": "InsufficientCollateral(uint256,uint256)",
|
|
11384
11387
|
"0x613970e0": "InvalidParameter()",
|
|
11385
11388
|
"0x27d08510": "NotActiveBroker(address)",
|
|
11386
11389
|
"0xf6412b5a": "NotOrderOwner()",
|
|
11387
11390
|
"0x70d645e3": "NotPositionOwner()",
|
|
11388
11391
|
"0xe75316c6": "OrderNotExist(OrderId)",
|
|
11389
11392
|
"0xba01b06f": "PoolNotActive(PoolId)",
|
|
11393
|
+
"0xddefae28": "AlreadyMinted()",
|
|
11390
11394
|
"0x64283d7b": "ERC721IncorrectOwner(address,uint256,address)",
|
|
11391
11395
|
"0x177e802f": "ERC721InsufficientApproval(address,uint256)",
|
|
11392
11396
|
"0xa9fbf51f": "ERC721InvalidApprover(address)",
|
|
@@ -11395,10 +11399,11 @@ var customErrorMapping = {
|
|
|
11395
11399
|
"0x64a0ae92": "ERC721InvalidReceiver(address)",
|
|
11396
11400
|
"0x73c6ac6e": "ERC721InvalidSender(address)",
|
|
11397
11401
|
"0x7e273289": "ERC721NonexistentToken(uint256)",
|
|
11398
|
-
"
|
|
11402
|
+
"0xb4762117": "ExceedMaxLeverage(PositionId)",
|
|
11399
11403
|
"0x29143a42": "ExceedPositionSize()",
|
|
11400
|
-
"
|
|
11401
|
-
"
|
|
11404
|
+
"0x8ea9158f": "InvalidPosition(PositionId)",
|
|
11405
|
+
"0xa5afd143": "PositionNotHealthy(PositionId,uint256)",
|
|
11406
|
+
"0xba0d3752": "PositionNotInitialized(PositionId)",
|
|
11402
11407
|
"0xc20f35b7": "UnderflowOI()",
|
|
11403
11408
|
"0xf4d678b8": "InsufficientBalance()",
|
|
11404
11409
|
"0x6aee3c1a": "InsufficientRiskReserves()",
|
|
@@ -11413,6 +11418,7 @@ var customErrorMapping = {
|
|
|
11413
11418
|
"0xc7544914": "ExceedDebt(uint256,uint256)",
|
|
11414
11419
|
"0xe7aa687a": "ExceedExchangeable()",
|
|
11415
11420
|
"0xdb42144d": "InsufficientBalance(address,uint256,uint256)",
|
|
11421
|
+
"0x5646203f": "InsufficientCollateral(PositionId,uint256)",
|
|
11416
11422
|
"0xf645eedf": "ECDSAInvalidSignature()",
|
|
11417
11423
|
"0xfce698f7": "ECDSAInvalidSignatureLength(uint256)",
|
|
11418
11424
|
"0xd78bce0c": "ECDSAInvalidSignatureS(bytes32)",
|
|
@@ -11433,11 +11439,10 @@ var customErrorMapping = {
|
|
|
11433
11439
|
"0xe079169e": "NotReachedPrice(OrderId,uint256,uint256,TriggerType)",
|
|
11434
11440
|
"0xc60eb335": "OnlyKeeper()",
|
|
11435
11441
|
"0xa8ce4432": "SafeCastOverflowedIntToUint(int256)",
|
|
11436
|
-
"
|
|
11437
|
-
"0xfda4bbac": "NotMeetEarlyCloseCriteria(PositionId)",
|
|
11442
|
+
"0x17229ec4": "NotMeetEarlyCloseCriteria(PositionId)",
|
|
11438
11443
|
"0x0dc149f0": "AlreadyInitialized()",
|
|
11439
11444
|
"0x7a5c919f": "InvalidRewindPrice()",
|
|
11440
|
-
"
|
|
11445
|
+
"0xc53f84e7": "PositionRemainsHealthy(PositionId)",
|
|
11441
11446
|
"0x230e8e43": "PoolNotInPreBenchState(PoolId)",
|
|
11442
11447
|
"0x664431a8": "NotAllowedTarget(address)",
|
|
11443
11448
|
"0x03357c6c": "ExceedsMaximumRelayFee()",
|
|
@@ -11445,6 +11450,8 @@ var customErrorMapping = {
|
|
|
11445
11450
|
"0x38802743": "InsufficientFeeAllowance(address,uint256,uint256)",
|
|
11446
11451
|
"0xd95b4ad5": "InsufficientFeeBalance(address,uint256,uint256)",
|
|
11447
11452
|
"0xa3972305": "MismatchedSender(address)",
|
|
11453
|
+
"0xc3b80e86": "RelayerRegistered(address)",
|
|
11454
|
+
"0xee0844a3": "RemoveRelayerFailed()",
|
|
11448
11455
|
"0xc583a8da": "IncorrectFee(uint256)",
|
|
11449
11456
|
"0x00bfc921": "InvalidPrice()",
|
|
11450
11457
|
"0x148cd0dd": "VerifyPriceFailed()",
|
|
@@ -11463,7 +11470,9 @@ var customErrorMapping = {
|
|
|
11463
11470
|
"0x7bd42a2e": "NotEmptyAddress()",
|
|
11464
11471
|
"0x6697b232": "AccessControlBadConfirmation()",
|
|
11465
11472
|
"0xe2517d3f": "AccessControlUnauthorizedAccount(address,bytes32)",
|
|
11473
|
+
"0x7c9a1cf9": "AlreadyVoted()",
|
|
11466
11474
|
"0x796ea3a6": "BondNotReleased()",
|
|
11475
|
+
"0xf38e5973": "CaseAppealNotFinished()",
|
|
11467
11476
|
"0x63d39157": "CaseCanNotAppeal()",
|
|
11468
11477
|
"0x1eaa4a59": "CaseDeadlineNotReached()",
|
|
11469
11478
|
"0xe6c67e3a": "CaseDeadlineReached()",
|
|
@@ -11475,17 +11484,16 @@ var customErrorMapping = {
|
|
|
11475
11484
|
"0xdcdedda9": "InvalidPoolToken()",
|
|
11476
11485
|
"0xc546bca4": "NotCaseRespondent(CaseId,address)",
|
|
11477
11486
|
"0x784fd7f1": "OnlyActiveValidator()",
|
|
11487
|
+
"0xc00ca938": "UnexpectedCaseState()",
|
|
11478
11488
|
"0xa9214540": "AlreadyClaimed(CaseId,address)",
|
|
11479
11489
|
"0xd4ac59c1": "InvalidAmount(CaseId,address)",
|
|
11480
11490
|
"0x7a6f5328": "MerkleTreeVerificationFailed(CaseId,address)",
|
|
11481
11491
|
"0x094a5cfe": "ReimbursementValidity(CaseId)",
|
|
11482
|
-
"
|
|
11483
|
-
"
|
|
11492
|
+
"0xb04111ef": "InsufficientFreeCollateral(PositionId,uint256)",
|
|
11493
|
+
"0x12f1b11a": "InsufficientLockedCollateral(PositionId,uint256)",
|
|
11484
11494
|
"0x6dfcc650": "SafeCastOverflowedUintDowncast(uint8,uint256)",
|
|
11485
11495
|
"0x1c151780": "ExceedMinOutput(uint256,uint256)",
|
|
11486
11496
|
"0xe1f0493d": "NotAllowedCaller(address)",
|
|
11487
|
-
"0x059e2f49": "InRewindMode()",
|
|
11488
|
-
"0x8637dfc0": "NotInRewindMode()",
|
|
11489
11497
|
"0xfb8f41b2": "ERC20InsufficientAllowance(address,uint256,uint256)",
|
|
11490
11498
|
"0xe450d38c": "ERC20InsufficientBalance(address,uint256,uint256)",
|
|
11491
11499
|
"0xe602df05": "ERC20InvalidApprover(address)",
|
|
@@ -11498,15 +11506,15 @@ var customErrorMapping = {
|
|
|
11498
11506
|
"0xb3512b0c": "InvalidShortString()",
|
|
11499
11507
|
"0x305a27a9": "StringTooLong(string)",
|
|
11500
11508
|
"0xfd0f789d": "ExceedMaxPriceDeviation()",
|
|
11501
|
-
"
|
|
11509
|
+
"0x18b88897": "InvalidUpdateFee()",
|
|
11502
11510
|
"0x19abf40e": "StalePrice()",
|
|
11503
11511
|
"0xe351cd13": "ExceedMaxExchangeableAmount()",
|
|
11504
11512
|
"0x15912a6f": "NotSupportVersion()",
|
|
11505
11513
|
"0xf1364a74": "ArrayEmpty()",
|
|
11506
11514
|
"0x15ed381d": "ExceedMaxProfit()",
|
|
11507
|
-
"0x42301c23": "InsufficientOutputAmount()",
|
|
11508
11515
|
"0x51aeee6c": "PoolNotExist(PoolId)",
|
|
11509
11516
|
"0x70f6c197": "InvalidQuoteTokenAddress()",
|
|
11517
|
+
"0x0b8457f4": "InvalidRatioParams()",
|
|
11510
11518
|
"0x29dae146": "MarketAlreadyExisted()",
|
|
11511
11519
|
"0x0e442a4a": "InvalidBaseToken()",
|
|
11512
11520
|
"0x24e219c7": "MarketNotExist(MarketId)",
|
|
@@ -11568,16 +11576,24 @@ async function getErrorTextFormError(error) {
|
|
|
11568
11576
|
const errorKey = Object.keys(customErrorMapping).find((k) => k.toLowerCase() === decodeErrorResult.selector.toLowerCase());
|
|
11569
11577
|
if (errorKey) {
|
|
11570
11578
|
return {
|
|
11571
|
-
error:
|
|
11579
|
+
error: {
|
|
11580
|
+
code: errorKey,
|
|
11581
|
+
message: customErrorMapping[errorKey]
|
|
11582
|
+
}
|
|
11572
11583
|
};
|
|
11573
11584
|
}
|
|
11574
11585
|
return {
|
|
11575
|
-
error:
|
|
11586
|
+
error: {
|
|
11587
|
+
code: error?.code,
|
|
11588
|
+
message: error?.reason || decodeErrorResult.reason || error.message
|
|
11589
|
+
}
|
|
11576
11590
|
};
|
|
11577
11591
|
}
|
|
11578
|
-
console.error(error);
|
|
11579
11592
|
return {
|
|
11580
|
-
error:
|
|
11593
|
+
error: {
|
|
11594
|
+
code: decodeErrorResult.type,
|
|
11595
|
+
message: decodeErrorResult.reason
|
|
11596
|
+
}
|
|
11581
11597
|
};
|
|
11582
11598
|
}
|
|
11583
11599
|
|
|
@@ -12129,6 +12145,7 @@ var getRewards = async (params) => {
|
|
|
12129
12145
|
gasLimit,
|
|
12130
12146
|
gasPrice
|
|
12131
12147
|
});
|
|
12148
|
+
console.log("pendingUserRebates base result:", request);
|
|
12132
12149
|
return request;
|
|
12133
12150
|
} catch (error) {
|
|
12134
12151
|
console.error(error);
|
|
@@ -14197,7 +14214,7 @@ var Order = class {
|
|
|
14197
14214
|
params.executionFeeToken,
|
|
14198
14215
|
params.collateralAmount
|
|
14199
14216
|
);
|
|
14200
|
-
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId
|
|
14217
|
+
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId });
|
|
14201
14218
|
const marginAccountBalance = marginAccountBalanceRes?.data;
|
|
14202
14219
|
if (marginAccountBalanceRes.code !== 0) {
|
|
14203
14220
|
return {
|
|
@@ -14236,7 +14253,6 @@ var Order = class {
|
|
|
14236
14253
|
};
|
|
14237
14254
|
const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
|
|
14238
14255
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
14239
|
-
this.logger.info("seamlessWallet-->", seamlessWallet);
|
|
14240
14256
|
if (config.seamlessMode && authorized && seamlessWallet) {
|
|
14241
14257
|
if (needsApproval) {
|
|
14242
14258
|
const approvalResult = await this.utils.approveAuthorization({
|
|
@@ -14245,13 +14261,11 @@ var Order = class {
|
|
|
14245
14261
|
amount: ethers6.MaxUint256.toString(),
|
|
14246
14262
|
signer: seamlessWallet
|
|
14247
14263
|
});
|
|
14248
|
-
this.logger.info("approvalResult-->", approvalResult);
|
|
14249
14264
|
if (approvalResult.code !== 0) {
|
|
14250
14265
|
throw new Error(approvalResult.message);
|
|
14251
14266
|
}
|
|
14252
14267
|
}
|
|
14253
14268
|
const isEnoughGas = await this.utils.checkSeamlessGas(params.address);
|
|
14254
|
-
this.logger.info("isEnoughGas-->", isEnoughGas);
|
|
14255
14269
|
if (!isEnoughGas) {
|
|
14256
14270
|
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
|
|
14257
14271
|
}
|
|
@@ -19979,11 +19993,11 @@ var Utils = class {
|
|
|
19979
19993
|
};
|
|
19980
19994
|
}
|
|
19981
19995
|
}
|
|
19982
|
-
async getUserTradingFeeRate(assetClass
|
|
19996
|
+
async getUserTradingFeeRate(assetClass) {
|
|
19983
19997
|
const config = this.configManager.getConfig();
|
|
19984
19998
|
const brokerAddress = config.brokerAddress;
|
|
19985
19999
|
try {
|
|
19986
|
-
const provider = await getJSONProvider(chainId);
|
|
20000
|
+
const provider = await getJSONProvider(config.chainId);
|
|
19987
20001
|
const brokerContract = new ethers7.Contract(
|
|
19988
20002
|
brokerAddress,
|
|
19989
20003
|
Broker_default,
|
|
@@ -20904,7 +20918,7 @@ var Account = class {
|
|
|
20904
20918
|
/**
|
|
20905
20919
|
* get tradable amount
|
|
20906
20920
|
*/
|
|
20907
|
-
async getTradableAmount({ poolId
|
|
20921
|
+
async getTradableAmount({ poolId }) {
|
|
20908
20922
|
const config = this.configManager.getConfig();
|
|
20909
20923
|
if (!config.signer) {
|
|
20910
20924
|
throw new MyxSDKError(
|
|
@@ -20912,8 +20926,8 @@ var Account = class {
|
|
|
20912
20926
|
"Invalid signer"
|
|
20913
20927
|
);
|
|
20914
20928
|
}
|
|
20915
|
-
const contractAddress = getContractAddressByChainId(chainId);
|
|
20916
|
-
const provider = await getJSONProvider(chainId);
|
|
20929
|
+
const contractAddress = getContractAddressByChainId(config.chainId);
|
|
20930
|
+
const provider = await getJSONProvider(config.chainId);
|
|
20917
20931
|
const accountContract = new ethers8.Contract(
|
|
20918
20932
|
contractAddress.Account,
|
|
20919
20933
|
Account_default,
|