flash-sdk 10.6.0 → 10.6.2
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/OraclePrice.d.ts +1 -0
 - package/dist/OrderAccount.d.ts +1 -0
 - package/dist/PerpetualsClient.d.ts +6 -16
 - package/dist/PerpetualsClient.js +273 -472
 - package/dist/PoolAccount.d.ts +1 -0
 - package/dist/PoolDataClient.d.ts +1 -0
 - package/dist/PositionAccount.d.ts +1 -0
 - package/dist/TokenStakeAccount.d.ts +1 -0
 - package/dist/TokenVaultAccount.d.ts +1 -0
 - package/dist/TradingAccount.d.ts +1 -0
 - package/dist/ViewHelper.js +2 -2
 - package/dist/backupOracle.js +4 -4
 - package/dist/constants/index.d.ts +1 -0
 - package/dist/idl/perpetuals.d.ts +72 -505
 - package/dist/idl/perpetuals.js +72 -505
 - package/dist/tsconfig.tsbuildinfo +1 -1
 - package/dist/types/index.d.ts +1 -2
 - package/dist/types/index.js +3 -3
 - package/dist/utils/IdlCoder.js +7 -17
 - package/dist/utils/alt.js +6 -5
 - package/dist/utils/anchorCpiEvents.d.ts +1 -0
 - package/dist/utils/anchorCpiEvents.js +4 -4
 - package/dist/utils/index.js +6 -6
 - package/dist/utils/rpc.js +9 -9
 - package/package.json +1 -1
 
    
        package/dist/utils/index.js
    CHANGED
    
    | 
         @@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge 
     | 
|
| 
       9 
9 
     | 
    
         
             
                });
         
     | 
| 
       10 
10 
     | 
    
         
             
            };
         
     | 
| 
       11 
11 
     | 
    
         
             
            var __generator = (this && this.__generator) || function (thisArg, body) {
         
     | 
| 
       12 
     | 
    
         
            -
                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g 
     | 
| 
       13 
     | 
    
         
            -
                return g 
     | 
| 
      
 12 
     | 
    
         
            +
                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
         
     | 
| 
      
 13 
     | 
    
         
            +
                return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
         
     | 
| 
       14 
14 
     | 
    
         
             
                function verb(n) { return function (v) { return step([n, v]); }; }
         
     | 
| 
       15 
15 
     | 
    
         
             
                function step(op) {
         
     | 
| 
       16 
16 
     | 
    
         
             
                    if (f) throw new TypeError("Generator is already executing.");
         
     | 
| 
         @@ -39,10 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { 
     | 
|
| 
       39 
39 
     | 
    
         
             
                return (mod && mod.__esModule) ? mod : { "default": mod };
         
     | 
| 
       40 
40 
     | 
    
         
             
            };
         
     | 
| 
       41 
41 
     | 
    
         
             
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       42 
     | 
    
         
            -
            exports.checkedDecimalDiv = exports.checkedDecimalMul = exports.checkedDecimalCeilMul = exports.checkedCeilDiv = exports.scaleToExponent = exports.validateNumberString = exports.uiDecimalsToNative = exports.getUnixTs = void 0;
         
     | 
| 
       43 
     | 
    
         
            -
            exports.toUiDecimalsOldSDK = toUiDecimalsOldSDK;
         
     | 
| 
       44 
     | 
    
         
            -
            exports.nativeToUiDecimals = nativeToUiDecimals;
         
     | 
| 
       45 
     | 
    
         
            -
            exports.checkIfAccountExists = checkIfAccountExists;
         
     | 
| 
      
 42 
     | 
    
         
            +
            exports.checkedDecimalDiv = exports.checkedDecimalMul = exports.checkedDecimalCeilMul = exports.checkedCeilDiv = exports.scaleToExponent = exports.checkIfAccountExists = exports.nativeToUiDecimals = exports.validateNumberString = exports.uiDecimalsToNative = exports.toUiDecimalsOldSDK = exports.getUnixTs = void 0;
         
     | 
| 
       46 
43 
     | 
    
         
             
            var bn_js_1 = __importDefault(require("bn.js"));
         
     | 
| 
       47 
44 
     | 
    
         
             
            var constants_1 = require("../constants");
         
     | 
| 
       48 
45 
     | 
    
         
             
            var bignumber_js_1 = __importDefault(require("bignumber.js"));
         
     | 
| 
         @@ -92,6 +89,7 @@ function toUiDecimalsOldSDK(nativeAmount, decimals, precision, commaSeperated) { 
     | 
|
| 
       92 
89 
     | 
    
         
             
                    return r;
         
     | 
| 
       93 
90 
     | 
    
         
             
                }
         
     | 
| 
       94 
91 
     | 
    
         
             
            }
         
     | 
| 
      
 92 
     | 
    
         
            +
            exports.toUiDecimalsOldSDK = toUiDecimalsOldSDK;
         
     | 
| 
       95 
93 
     | 
    
         
             
            var uiDecimalsToNative = function (amountUi, decimals) {
         
     | 
| 
       96 
94 
     | 
    
         
             
                var valueBigNumber = (new bignumber_js_1.default(amountUi)).multipliedBy(new bignumber_js_1.default(Math.pow(10, decimals)));
         
     | 
| 
       97 
95 
     | 
    
         
             
                return new bn_js_1.default(valueBigNumber.toFixed(0, bignumber_js_1.default.ROUND_DOWN));
         
     | 
| 
         @@ -139,6 +137,7 @@ function nativeToUiDecimals(nativeAmount, decimals, precision, commaSeperated) { 
     | 
|
| 
       139 
137 
     | 
    
         
             
                    return r;
         
     | 
| 
       140 
138 
     | 
    
         
             
                }
         
     | 
| 
       141 
139 
     | 
    
         
             
            }
         
     | 
| 
      
 140 
     | 
    
         
            +
            exports.nativeToUiDecimals = nativeToUiDecimals;
         
     | 
| 
       142 
141 
     | 
    
         
             
            function checkIfAccountExists(account, connection) {
         
     | 
| 
       143 
142 
     | 
    
         
             
                return __awaiter(this, void 0, void 0, function () {
         
     | 
| 
       144 
143 
     | 
    
         
             
                    var bal;
         
     | 
| 
         @@ -158,6 +157,7 @@ function checkIfAccountExists(account, connection) { 
     | 
|
| 
       158 
157 
     | 
    
         
             
                    });
         
     | 
| 
       159 
158 
     | 
    
         
             
                });
         
     | 
| 
       160 
159 
     | 
    
         
             
            }
         
     | 
| 
      
 160 
     | 
    
         
            +
            exports.checkIfAccountExists = checkIfAccountExists;
         
     | 
| 
       161 
161 
     | 
    
         
             
            var scaleToExponent = function (arg, exponent, target_exponent) {
         
     | 
| 
       162 
162 
     | 
    
         
             
                if (target_exponent.eq(exponent)) {
         
     | 
| 
       163 
163 
     | 
    
         
             
                    return arg;
         
     | 
    
        package/dist/utils/rpc.js
    CHANGED
    
    | 
         @@ -24,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge 
     | 
|
| 
       24 
24 
     | 
    
         
             
                });
         
     | 
| 
       25 
25 
     | 
    
         
             
            };
         
     | 
| 
       26 
26 
     | 
    
         
             
            var __generator = (this && this.__generator) || function (thisArg, body) {
         
     | 
| 
       27 
     | 
    
         
            -
                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g 
     | 
| 
       28 
     | 
    
         
            -
                return g 
     | 
| 
      
 27 
     | 
    
         
            +
                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
         
     | 
| 
      
 28 
     | 
    
         
            +
                return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
         
     | 
| 
       29 
29 
     | 
    
         
             
                function verb(n) { return function (v) { return step([n, v]); }; }
         
     | 
| 
       30 
30 
     | 
    
         
             
                function step(op) {
         
     | 
| 
       31 
31 
     | 
    
         
             
                    if (f) throw new TypeError("Generator is already executing.");
         
     | 
| 
         @@ -63,13 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { 
     | 
|
| 
       63 
63 
     | 
    
         
             
                return (mod && mod.__esModule) ? mod : { "default": mod };
         
     | 
| 
       64 
64 
     | 
    
         
             
            };
         
     | 
| 
       65 
65 
     | 
    
         
             
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       66 
     | 
    
         
            -
            exports.TransactionFailError = exports.createComputeBudgetIx = void 0;
         
     | 
| 
       67 
     | 
    
         
            -
            exports.sendTransaction = sendTransaction;
         
     | 
| 
       68 
     | 
    
         
            -
            exports.confirmTransaction = confirmTransaction;
         
     | 
| 
       69 
     | 
    
         
            -
            exports.sendTransactionV2 = sendTransactionV2;
         
     | 
| 
       70 
     | 
    
         
            -
            exports.confirmTransactionV2 = confirmTransactionV2;
         
     | 
| 
       71 
     | 
    
         
            -
            exports.sendTransactionV3 = sendTransactionV3;
         
     | 
| 
       72 
     | 
    
         
            -
            exports.confirmTransactionV3 = confirmTransactionV3;
         
     | 
| 
      
 66 
     | 
    
         
            +
            exports.TransactionFailError = exports.createComputeBudgetIx = exports.confirmTransactionV3 = exports.sendTransactionV3 = exports.confirmTransactionV2 = exports.sendTransactionV2 = exports.confirmTransaction = exports.sendTransaction = void 0;
         
     | 
| 
       73 
67 
     | 
    
         
             
            var nodewallet_1 = __importDefault(require("@coral-xyz/anchor/dist/cjs/nodewallet"));
         
     | 
| 
       74 
68 
     | 
    
         
             
            var bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
         
     | 
| 
       75 
69 
     | 
    
         
             
            var web3_js_1 = require("@solana/web3.js");
         
     | 
| 
         @@ -124,6 +118,7 @@ function sendTransaction(provider_1, ixs_1) { 
     | 
|
| 
       124 
118 
     | 
    
         
             
                    });
         
     | 
| 
       125 
119 
     | 
    
         
             
                });
         
     | 
| 
       126 
120 
     | 
    
         
             
            }
         
     | 
| 
      
 121 
     | 
    
         
            +
            exports.sendTransaction = sendTransaction;
         
     | 
| 
       127 
122 
     | 
    
         
             
            function confirmTransaction(provider_1, signature_1) {
         
     | 
| 
       128 
123 
     | 
    
         
             
                return __awaiter(this, arguments, void 0, function (provider, signature, opts) {
         
     | 
| 
       129 
124 
     | 
    
         
             
                    var connection, latestBlockhash, _a, txConfirmationCommitment, status;
         
     | 
| 
         @@ -170,6 +165,7 @@ function confirmTransaction(provider_1, signature_1) { 
     | 
|
| 
       170 
165 
     | 
    
         
             
                    });
         
     | 
| 
       171 
166 
     | 
    
         
             
                });
         
     | 
| 
       172 
167 
     | 
    
         
             
            }
         
     | 
| 
      
 168 
     | 
    
         
            +
            exports.confirmTransaction = confirmTransaction;
         
     | 
| 
       173 
169 
     | 
    
         
             
            function sendTransactionV2(provider_1, ixs_1) {
         
     | 
| 
       174 
170 
     | 
    
         
             
                return __awaiter(this, arguments, void 0, function (provider, ixs, opts) {
         
     | 
| 
       175 
171 
     | 
    
         
             
                    var connection, latestBlockhash, _a, payer, message, vtx, signature;
         
     | 
| 
         @@ -221,6 +217,7 @@ function sendTransactionV2(provider_1, ixs_1) { 
     | 
|
| 
       221 
217 
     | 
    
         
             
                    });
         
     | 
| 
       222 
218 
     | 
    
         
             
                });
         
     | 
| 
       223 
219 
     | 
    
         
             
            }
         
     | 
| 
      
 220 
     | 
    
         
            +
            exports.sendTransactionV2 = sendTransactionV2;
         
     | 
| 
       224 
221 
     | 
    
         
             
            var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
         
     | 
| 
       225 
222 
     | 
    
         
             
            function confirmTransactionV2(provider_1, versionedTransaction_1, signature_1) {
         
     | 
| 
       226 
223 
     | 
    
         
             
                return __awaiter(this, arguments, void 0, function (provider, versionedTransaction, signature, opts) {
         
     | 
| 
         @@ -282,6 +279,7 @@ function confirmTransactionV2(provider_1, versionedTransaction_1, signature_1) { 
     | 
|
| 
       282 
279 
     | 
    
         
             
                    });
         
     | 
| 
       283 
280 
     | 
    
         
             
                });
         
     | 
| 
       284 
281 
     | 
    
         
             
            }
         
     | 
| 
      
 282 
     | 
    
         
            +
            exports.confirmTransactionV2 = confirmTransactionV2;
         
     | 
| 
       285 
283 
     | 
    
         
             
            function sendTransactionV3(provider_1, ixs_1) {
         
     | 
| 
       286 
284 
     | 
    
         
             
                return __awaiter(this, arguments, void 0, function (provider, ixs, opts) {
         
     | 
| 
       287 
285 
     | 
    
         
             
                    var connection, latestBlockhash, _a, payer, message, vtx, tx, signature;
         
     | 
| 
         @@ -334,6 +332,7 @@ function sendTransactionV3(provider_1, ixs_1) { 
     | 
|
| 
       334 
332 
     | 
    
         
             
                    });
         
     | 
| 
       335 
333 
     | 
    
         
             
                });
         
     | 
| 
       336 
334 
     | 
    
         
             
            }
         
     | 
| 
      
 335 
     | 
    
         
            +
            exports.sendTransactionV3 = sendTransactionV3;
         
     | 
| 
       337 
336 
     | 
    
         
             
            function confirmTransactionV3(provider_1, versionedTransaction_1, signature_1) {
         
     | 
| 
       338 
337 
     | 
    
         
             
                return __awaiter(this, arguments, void 0, function (provider, versionedTransaction, signature, opts) {
         
     | 
| 
       339 
338 
     | 
    
         
             
                    var connection, status, blockhashResponse, lastValidBlockHeight, blockheight, signatureStatuses, result, x;
         
     | 
| 
         @@ -400,6 +399,7 @@ function confirmTransactionV3(provider_1, versionedTransaction_1, signature_1) { 
     | 
|
| 
       400 
399 
     | 
    
         
             
                    });
         
     | 
| 
       401 
400 
     | 
    
         
             
                });
         
     | 
| 
       402 
401 
     | 
    
         
             
            }
         
     | 
| 
      
 402 
     | 
    
         
            +
            exports.confirmTransactionV3 = confirmTransactionV3;
         
     | 
| 
       403 
403 
     | 
    
         
             
            var createComputeBudgetIx = function (microLamports) {
         
     | 
| 
       404 
404 
     | 
    
         
             
                var computeBudgetIx = web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
         
     | 
| 
       405 
405 
     | 
    
         
             
                    microLamports: microLamports,
         
     |