flash-sdk 15.0.0-alpha.0 → 15.0.1-alpha.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.
- package/dist/PerpetualsClient.d.ts +6 -2
- package/dist/PerpetualsClient.js +108 -23
- package/dist/PoolConfig.json +2 -2
- package/dist/idl/perpetuals.d.ts +462 -0
- package/dist/idl/perpetuals.json +462 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/generated.d.ts +18 -0
- package/package.json +1 -1
|
@@ -890,7 +890,7 @@ export declare class PerpetualsClient {
|
|
|
890
890
|
instructions: TransactionInstruction[];
|
|
891
891
|
additionalSigners: Signer[];
|
|
892
892
|
}>;
|
|
893
|
-
setCustody: (poolName: string, tokenMint: PublicKey, depegAdjustment: boolean, inversePrice: boolean, oracle: OracleParams, pricingConfig: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
|
|
893
|
+
setCustody: (poolName: string, tokenMint: PublicKey, isVirtual: boolean, depegAdjustment: boolean, inversePrice: boolean, oracle: OracleParams, pricingConfig: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
|
|
894
894
|
instructions: TransactionInstruction[];
|
|
895
895
|
additionalSigners: Signer[];
|
|
896
896
|
}>;
|
|
@@ -910,7 +910,11 @@ export declare class PerpetualsClient {
|
|
|
910
910
|
instructions: TransactionInstruction[];
|
|
911
911
|
additionalSigners: Signer[];
|
|
912
912
|
}>;
|
|
913
|
-
|
|
913
|
+
migrateMarketPosition: (poolName: string, oldMarket: PublicKey, newMarket: PublicKey, oldCollateralCustody: PublicKey, newCollateralCustody: PublicKey, owner: PublicKey) => Promise<{
|
|
914
|
+
instructions: TransactionInstruction[];
|
|
915
|
+
additionalSigners: Signer[];
|
|
916
|
+
}>;
|
|
917
|
+
migrateMarketOrder: (poolName: string, oldMarket: PublicKey, newMarket: PublicKey, oldCollateralCustody: PublicKey, newCollateralCustody: PublicKey, owner?: PublicKey) => Promise<{
|
|
914
918
|
instructions: TransactionInstruction[];
|
|
915
919
|
additionalSigners: Signer[];
|
|
916
920
|
}>;
|
package/dist/PerpetualsClient.js
CHANGED
|
@@ -8421,7 +8421,7 @@ var PerpetualsClient = (function () {
|
|
|
8421
8421
|
], this.program.programId)[0];
|
|
8422
8422
|
return [4, this.program.methods
|
|
8423
8423
|
.addMarket({
|
|
8424
|
-
side: side
|
|
8424
|
+
side: (0, types_1.isVariant)(side, 'long') ? { long: {} } : { short: {} },
|
|
8425
8425
|
correlation: correlation,
|
|
8426
8426
|
maxPayoffBps: maxPayoffBps,
|
|
8427
8427
|
permissions: permissions
|
|
@@ -8454,7 +8454,7 @@ var PerpetualsClient = (function () {
|
|
|
8454
8454
|
}
|
|
8455
8455
|
});
|
|
8456
8456
|
}); };
|
|
8457
|
-
this.setCustody = function (poolName, tokenMint, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, rewardThreshold, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8457
|
+
this.setCustody = function (poolName, tokenMint, isVirtual, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, rewardThreshold, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8458
8458
|
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_72;
|
|
8459
8459
|
return __generator(this, function (_a) {
|
|
8460
8460
|
switch (_a.label) {
|
|
@@ -8469,6 +8469,7 @@ var PerpetualsClient = (function () {
|
|
|
8469
8469
|
_a.trys.push([1, 3, , 4]);
|
|
8470
8470
|
return [4, this.program.methods
|
|
8471
8471
|
.setCustodyConfig({
|
|
8472
|
+
isVirtual: isVirtual,
|
|
8472
8473
|
depegAdjustment: depegAdjustment,
|
|
8473
8474
|
inversePrice: inversePrice,
|
|
8474
8475
|
oracle: oracle,
|
|
@@ -8485,8 +8486,11 @@ var PerpetualsClient = (function () {
|
|
|
8485
8486
|
.accountsPartial({
|
|
8486
8487
|
admin: this.admin,
|
|
8487
8488
|
multisig: this.multisig.publicKey,
|
|
8489
|
+
perpetuals: this.perpetuals.publicKey,
|
|
8488
8490
|
pool: this.getPoolKey(poolName),
|
|
8489
8491
|
custody: this.getCustodyKey(poolName, tokenMint),
|
|
8492
|
+
custodyOracleAccount: oracle.intOracleAccount,
|
|
8493
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
8490
8494
|
})
|
|
8491
8495
|
.instruction()];
|
|
8492
8496
|
case 2:
|
|
@@ -8662,50 +8666,131 @@ var PerpetualsClient = (function () {
|
|
|
8662
8666
|
console.log("perpClient refreshPositionsStatus error:: ", err_76);
|
|
8663
8667
|
throw err_76;
|
|
8664
8668
|
case 4: return [2, {
|
|
8665
|
-
instructions: instructions,
|
|
8669
|
+
instructions: __spreadArray([], instructions, true),
|
|
8666
8670
|
additionalSigners: additionalSigners
|
|
8667
8671
|
}];
|
|
8668
8672
|
}
|
|
8669
8673
|
});
|
|
8670
8674
|
}); };
|
|
8671
|
-
this.
|
|
8672
|
-
var instructions, additionalSigners,
|
|
8675
|
+
this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8676
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_77;
|
|
8673
8677
|
return __generator(this, function (_a) {
|
|
8674
8678
|
switch (_a.label) {
|
|
8675
8679
|
case 0:
|
|
8680
|
+
preInstructions = [];
|
|
8676
8681
|
instructions = [];
|
|
8682
|
+
postInstructions = [];
|
|
8677
8683
|
additionalSigners = [];
|
|
8678
8684
|
_a.label = 1;
|
|
8679
8685
|
case 1:
|
|
8680
|
-
_a.trys.push([1,
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
+
_a.trys.push([1, 5, , 6]);
|
|
8687
|
+
oldPosition = this.findProgramAddress("position", [
|
|
8688
|
+
owner,
|
|
8689
|
+
oldMarket,
|
|
8690
|
+
]).publicKey;
|
|
8691
|
+
newPosition = this.findProgramAddress("position", [
|
|
8692
|
+
owner,
|
|
8693
|
+
newMarket,
|
|
8694
|
+
]).publicKey;
|
|
8695
|
+
return [4, this.program.account.custody.fetch(oldCollateralCustody)];
|
|
8696
|
+
case 2:
|
|
8697
|
+
oldCollateralCustodyAccount = _a.sent();
|
|
8698
|
+
return [4, this.program.account.custody.fetch(newCollateralCustody)];
|
|
8699
|
+
case 3:
|
|
8700
|
+
newCollateralCustodyAccount = _a.sent();
|
|
8686
8701
|
return [4, this.program.methods
|
|
8687
|
-
.
|
|
8702
|
+
.migrateMarketPosition({})
|
|
8688
8703
|
.accountsPartial({
|
|
8689
|
-
|
|
8690
|
-
|
|
8704
|
+
feePayer: this.provider.wallet.publicKey,
|
|
8705
|
+
perpetuals: this.perpetuals.publicKey,
|
|
8706
|
+
pool: this.getPoolKey(poolName),
|
|
8707
|
+
oldPosition: oldPosition,
|
|
8708
|
+
oldMarket: oldMarket,
|
|
8709
|
+
oldCollateralOracleAccount: oldCollateralCustodyAccount.oracle.intOracleAccount,
|
|
8710
|
+
oldCollateralCustody: oldCollateralCustody,
|
|
8711
|
+
newPosition: newPosition,
|
|
8712
|
+
newMarket: newMarket,
|
|
8713
|
+
newCollateralCustody: newCollateralCustody,
|
|
8714
|
+
newCollateralOracleAccount: newCollateralCustodyAccount.oracle.intOracleAccount,
|
|
8715
|
+
eventAuthority: this.eventAuthority.publicKey,
|
|
8716
|
+
program: this.programId,
|
|
8717
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
8718
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
8691
8719
|
})
|
|
8692
|
-
.remainingAccounts(remainingAccounts)
|
|
8693
8720
|
.instruction()];
|
|
8694
|
-
case
|
|
8695
|
-
|
|
8696
|
-
instructions.push(
|
|
8697
|
-
return [3,
|
|
8698
|
-
case
|
|
8721
|
+
case 4:
|
|
8722
|
+
migrateMarketPositionInstruction = _a.sent();
|
|
8723
|
+
instructions.push(migrateMarketPositionInstruction);
|
|
8724
|
+
return [3, 6];
|
|
8725
|
+
case 5:
|
|
8699
8726
|
err_77 = _a.sent();
|
|
8700
|
-
console.log("perpClient
|
|
8727
|
+
console.log("perpClient migrateMarketPosition error:: ", err_77);
|
|
8701
8728
|
throw err_77;
|
|
8702
|
-
case
|
|
8703
|
-
instructions: instructions,
|
|
8729
|
+
case 6: return [2, {
|
|
8730
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8704
8731
|
additionalSigners: additionalSigners
|
|
8705
8732
|
}];
|
|
8706
8733
|
}
|
|
8707
8734
|
});
|
|
8708
8735
|
}); };
|
|
8736
|
+
this.migrateMarketOrder = function (poolName_1, oldMarket_1, newMarket_1, oldCollateralCustody_1, newCollateralCustody_1) {
|
|
8737
|
+
var args_1 = [];
|
|
8738
|
+
for (var _i = 5; _i < arguments.length; _i++) {
|
|
8739
|
+
args_1[_i - 5] = arguments[_i];
|
|
8740
|
+
}
|
|
8741
|
+
return __awaiter(_this, __spreadArray([poolName_1, oldMarket_1, newMarket_1, oldCollateralCustody_1, newCollateralCustody_1], args_1, true), void 0, function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) {
|
|
8742
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_78;
|
|
8743
|
+
if (owner === void 0) { owner = this.provider.wallet.publicKey; }
|
|
8744
|
+
return __generator(this, function (_a) {
|
|
8745
|
+
switch (_a.label) {
|
|
8746
|
+
case 0:
|
|
8747
|
+
preInstructions = [];
|
|
8748
|
+
instructions = [];
|
|
8749
|
+
postInstructions = [];
|
|
8750
|
+
additionalSigners = [];
|
|
8751
|
+
_a.label = 1;
|
|
8752
|
+
case 1:
|
|
8753
|
+
_a.trys.push([1, 3, , 4]);
|
|
8754
|
+
void poolName;
|
|
8755
|
+
void oldCollateralCustody;
|
|
8756
|
+
void newCollateralCustody;
|
|
8757
|
+
oldOrder = this.findProgramAddress("order", [
|
|
8758
|
+
owner,
|
|
8759
|
+
oldMarket,
|
|
8760
|
+
]).publicKey;
|
|
8761
|
+
newOrder = this.findProgramAddress("order", [
|
|
8762
|
+
owner,
|
|
8763
|
+
newMarket,
|
|
8764
|
+
]).publicKey;
|
|
8765
|
+
return [4, this.program.methods
|
|
8766
|
+
.migrateMarketOrder({})
|
|
8767
|
+
.accountsPartial({
|
|
8768
|
+
feePayer: this.provider.wallet.publicKey,
|
|
8769
|
+
oldOrder: oldOrder,
|
|
8770
|
+
oldMarket: oldMarket,
|
|
8771
|
+
newOrder: newOrder,
|
|
8772
|
+
newMarket: newMarket,
|
|
8773
|
+
program: this.programId,
|
|
8774
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
8775
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
8776
|
+
})
|
|
8777
|
+
.instruction()];
|
|
8778
|
+
case 2:
|
|
8779
|
+
migrateMarketOrderInstruction = _a.sent();
|
|
8780
|
+
instructions.push(migrateMarketOrderInstruction);
|
|
8781
|
+
return [3, 4];
|
|
8782
|
+
case 3:
|
|
8783
|
+
err_78 = _a.sent();
|
|
8784
|
+
console.log("perpClient migrateMarketOrder error:: ", err_78);
|
|
8785
|
+
throw err_78;
|
|
8786
|
+
case 4: return [2, {
|
|
8787
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8788
|
+
additionalSigners: additionalSigners
|
|
8789
|
+
}];
|
|
8790
|
+
}
|
|
8791
|
+
});
|
|
8792
|
+
});
|
|
8793
|
+
};
|
|
8709
8794
|
this.provider = provider;
|
|
8710
8795
|
(0, anchor_1.setProvider)(provider);
|
|
8711
8796
|
var idlWithAddress = __assign(__assign({}, perpetuals_json_1.default), { address: programId.toBase58() });
|
package/dist/PoolConfig.json
CHANGED
|
@@ -3754,7 +3754,7 @@
|
|
|
3754
3754
|
"usdPrecision": 4,
|
|
3755
3755
|
"tokenPrecision": 4,
|
|
3756
3756
|
"isStable": false,
|
|
3757
|
-
"isVirtual":
|
|
3757
|
+
"isVirtual": true,
|
|
3758
3758
|
"lazerId": 2382,
|
|
3759
3759
|
"pythTicker": "Crypto.MET/USD",
|
|
3760
3760
|
"pythPriceId": "0x0292e0f405bcd4a496d34e48307f6787349ad2bcd8505c3d3a9f77d81a67a682",
|
|
@@ -3891,7 +3891,7 @@
|
|
|
3891
3891
|
"usdPrecision": 4,
|
|
3892
3892
|
"tokenPrecision": 4,
|
|
3893
3893
|
"isStable": false,
|
|
3894
|
-
"isVirtual":
|
|
3894
|
+
"isVirtual": true,
|
|
3895
3895
|
"intOracleAddress": "792tp3W9dzvfofq65LgtoJdfCdb9cRoXm1pAT3nxNEbG",
|
|
3896
3896
|
"extOracleAddress": "BEMsCSQEGi2kwPA4mKnGjxnreijhMki7L4eeb96ypzF9",
|
|
3897
3897
|
"lazerId": 2382,
|