@exponent-labs/kamino-reserve-deserializer 0.0.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/CHANGELOG.md +16 -0
- package/build/fraction.d.ts +23 -0
- package/build/fraction.js +61 -0
- package/build/fraction.js.map +1 -0
- package/build/index.d.ts +102 -0
- package/build/index.js +214 -0
- package/build/index.js.map +1 -0
- package/build/types/BigFractionBytes.d.ts +26 -0
- package/build/types/BigFractionBytes.js +72 -0
- package/build/types/BigFractionBytes.js.map +1 -0
- package/build/types/BorrowRateCurve.d.ts +27 -0
- package/build/types/BorrowRateCurve.js +63 -0
- package/build/types/BorrowRateCurve.js.map +1 -0
- package/build/types/CurvePoint.d.ts +25 -0
- package/build/types/CurvePoint.js +68 -0
- package/build/types/CurvePoint.js.map +1 -0
- package/build/types/LastUpdate.d.ts +46 -0
- package/build/types/LastUpdate.js +88 -0
- package/build/types/LastUpdate.js.map +1 -0
- package/build/types/PriceHeuristic.d.ts +40 -0
- package/build/types/PriceHeuristic.js +81 -0
- package/build/types/PriceHeuristic.js.map +1 -0
- package/build/types/PythConfiguration.d.ts +24 -0
- package/build/types/PythConfiguration.js +64 -0
- package/build/types/PythConfiguration.js.map +1 -0
- package/build/types/ReserveCollateral.d.ts +52 -0
- package/build/types/ReserveCollateral.js +101 -0
- package/build/types/ReserveCollateral.js.map +1 -0
- package/build/types/ReserveConfig.d.ts +366 -0
- package/build/types/ReserveConfig.js +307 -0
- package/build/types/ReserveConfig.js.map +1 -0
- package/build/types/ReserveFees.d.ts +77 -0
- package/build/types/ReserveFees.js +98 -0
- package/build/types/ReserveFees.js.map +1 -0
- package/build/types/ReserveLiquidity.d.ts +181 -0
- package/build/types/ReserveLiquidity.js +214 -0
- package/build/types/ReserveLiquidity.js.map +1 -0
- package/build/types/ScopeConfiguration.d.ts +40 -0
- package/build/types/ScopeConfiguration.js +82 -0
- package/build/types/ScopeConfiguration.js.map +1 -0
- package/build/types/SwitchboardConfiguration.d.ts +29 -0
- package/build/types/SwitchboardConfiguration.js +70 -0
- package/build/types/SwitchboardConfiguration.js.map +1 -0
- package/build/types/TokenInfo.d.ts +121 -0
- package/build/types/TokenInfo.js +154 -0
- package/build/types/TokenInfo.js.map +1 -0
- package/build/types/WithdrawalCaps.d.ts +37 -0
- package/build/types/WithdrawalCaps.js +90 -0
- package/build/types/WithdrawalCaps.js.map +1 -0
- package/build/types/index.d.ts +46 -0
- package/build/types/index.js +88 -0
- package/build/types/index.js.map +1 -0
- package/package.json +20 -0
- package/src/fraction.ts +70 -0
- package/src/index.ts +269 -0
- package/src/types/BigFractionBytes.ts +59 -0
- package/src/types/BorrowRateCurve.ts +53 -0
- package/src/types/CurvePoint.ts +58 -0
- package/src/types/LastUpdate.ts +88 -0
- package/src/types/PriceHeuristic.ts +76 -0
- package/src/types/PythConfiguration.ts +54 -0
- package/src/types/ReserveCollateral.ts +103 -0
- package/src/types/ReserveConfig.ts +431 -0
- package/src/types/ReserveFees.ts +116 -0
- package/src/types/ReserveLiquidity.ts +280 -0
- package/src/types/ScopeConfiguration.ts +83 -0
- package/src/types/SwitchboardConfiguration.ts +62 -0
- package/src/types/TokenInfo.ts +178 -0
- package/src/types/WithdrawalCaps.ts +84 -0
- package/src/types/index.ts +88 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ScopeConfiguration = void 0;
|
|
27
|
+
const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
+
const borsh = __importStar(require("@coral-xyz/borsh"));
|
|
29
|
+
class ScopeConfiguration {
|
|
30
|
+
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
31
|
+
priceFeed;
|
|
32
|
+
/** This is the scope_id price chain that results in a price for the token */
|
|
33
|
+
priceChain;
|
|
34
|
+
/** This is the scope_id price chain for the twap */
|
|
35
|
+
twapChain;
|
|
36
|
+
constructor(fields) {
|
|
37
|
+
this.priceFeed = fields.priceFeed;
|
|
38
|
+
this.priceChain = fields.priceChain;
|
|
39
|
+
this.twapChain = fields.twapChain;
|
|
40
|
+
}
|
|
41
|
+
static layout(property) {
|
|
42
|
+
return borsh.struct([
|
|
43
|
+
borsh.publicKey("priceFeed"),
|
|
44
|
+
borsh.array(borsh.u16(), 4, "priceChain"),
|
|
45
|
+
borsh.array(borsh.u16(), 4, "twapChain"),
|
|
46
|
+
], property);
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
static fromDecoded(obj) {
|
|
50
|
+
return new ScopeConfiguration({
|
|
51
|
+
priceFeed: obj.priceFeed,
|
|
52
|
+
priceChain: obj.priceChain,
|
|
53
|
+
twapChain: obj.twapChain,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
static toEncodable(fields) {
|
|
57
|
+
return {
|
|
58
|
+
priceFeed: fields.priceFeed,
|
|
59
|
+
priceChain: fields.priceChain,
|
|
60
|
+
twapChain: fields.twapChain,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
toJSON() {
|
|
64
|
+
return {
|
|
65
|
+
priceFeed: this.priceFeed.toString(),
|
|
66
|
+
priceChain: this.priceChain,
|
|
67
|
+
twapChain: this.twapChain,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static fromJSON(obj) {
|
|
71
|
+
return new ScopeConfiguration({
|
|
72
|
+
priceFeed: new web3_js_1.PublicKey(obj.priceFeed),
|
|
73
|
+
priceChain: obj.priceChain,
|
|
74
|
+
twapChain: obj.twapChain,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
toEncodable() {
|
|
78
|
+
return ScopeConfiguration.toEncodable(this);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ScopeConfiguration = ScopeConfiguration;
|
|
82
|
+
//# sourceMappingURL=ScopeConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopeConfiguration.js","sourceRoot":"","sources":["../../src/types/ScopeConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C,CAAC,wDAAwD;AACpG,wDAAyC;AAoBzC,MAAa,kBAAkB;IAC7B,uEAAuE;IAC9D,SAAS,CAAW;IAC7B,6EAA6E;IACpE,UAAU,CAAe;IAClC,oDAAoD;IAC3C,SAAS,CAAe;IAEjC,YAAY,MAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,UAAU,GAAG,MAA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WAAW;QACT,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF;AA7DD,gDA6DC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
export interface SwitchboardConfigurationFields {
|
|
3
|
+
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
4
|
+
priceAggregator: PublicKey;
|
|
5
|
+
twapAggregator: PublicKey;
|
|
6
|
+
}
|
|
7
|
+
export interface SwitchboardConfigurationJSON {
|
|
8
|
+
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
9
|
+
priceAggregator: string;
|
|
10
|
+
twapAggregator: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class SwitchboardConfiguration {
|
|
13
|
+
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
14
|
+
readonly priceAggregator: PublicKey;
|
|
15
|
+
readonly twapAggregator: PublicKey;
|
|
16
|
+
constructor(fields: SwitchboardConfigurationFields);
|
|
17
|
+
static layout(property?: string): any;
|
|
18
|
+
static fromDecoded(obj: any): SwitchboardConfiguration;
|
|
19
|
+
static toEncodable(fields: SwitchboardConfigurationFields): {
|
|
20
|
+
priceAggregator: PublicKey;
|
|
21
|
+
twapAggregator: PublicKey;
|
|
22
|
+
};
|
|
23
|
+
toJSON(): SwitchboardConfigurationJSON;
|
|
24
|
+
static fromJSON(obj: SwitchboardConfigurationJSON): SwitchboardConfiguration;
|
|
25
|
+
toEncodable(): {
|
|
26
|
+
priceAggregator: PublicKey;
|
|
27
|
+
twapAggregator: PublicKey;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SwitchboardConfiguration = void 0;
|
|
27
|
+
const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
+
const borsh = __importStar(require("@coral-xyz/borsh"));
|
|
29
|
+
class SwitchboardConfiguration {
|
|
30
|
+
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
31
|
+
priceAggregator;
|
|
32
|
+
twapAggregator;
|
|
33
|
+
constructor(fields) {
|
|
34
|
+
this.priceAggregator = fields.priceAggregator;
|
|
35
|
+
this.twapAggregator = fields.twapAggregator;
|
|
36
|
+
}
|
|
37
|
+
static layout(property) {
|
|
38
|
+
return borsh.struct([borsh.publicKey("priceAggregator"), borsh.publicKey("twapAggregator")], property);
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
static fromDecoded(obj) {
|
|
42
|
+
return new SwitchboardConfiguration({
|
|
43
|
+
priceAggregator: obj.priceAggregator,
|
|
44
|
+
twapAggregator: obj.twapAggregator,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static toEncodable(fields) {
|
|
48
|
+
return {
|
|
49
|
+
priceAggregator: fields.priceAggregator,
|
|
50
|
+
twapAggregator: fields.twapAggregator,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
toJSON() {
|
|
54
|
+
return {
|
|
55
|
+
priceAggregator: this.priceAggregator.toString(),
|
|
56
|
+
twapAggregator: this.twapAggregator.toString(),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static fromJSON(obj) {
|
|
60
|
+
return new SwitchboardConfiguration({
|
|
61
|
+
priceAggregator: new web3_js_1.PublicKey(obj.priceAggregator),
|
|
62
|
+
twapAggregator: new web3_js_1.PublicKey(obj.twapAggregator),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
toEncodable() {
|
|
66
|
+
return SwitchboardConfiguration.toEncodable(this);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.SwitchboardConfiguration = SwitchboardConfiguration;
|
|
70
|
+
//# sourceMappingURL=SwitchboardConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchboardConfiguration.js","sourceRoot":"","sources":["../../src/types/SwitchboardConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C,CAAC,wDAAwD;AACpG,wDAAyC;AAczC,MAAa,wBAAwB;IACnC,sEAAsE;IAC7D,eAAe,CAAW;IAC1B,cAAc,CAAW;IAElC,YAAY,MAAsC;QAChD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;QAC7C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;IAC7C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAiB;QAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;IACxG,CAAC;IAED,8DAA8D;IAC9D,MAAM,CAAC,WAAW,CAAC,GAAQ;QACzB,OAAO,IAAI,wBAAwB,CAAC;YAClC,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,cAAc,EAAE,GAAG,CAAC,cAAc;SACnC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAAsC;QACvD,OAAO;YACL,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO;YACL,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;YAChD,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;SAC/C,CAAA;IACH,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAiC;QAC/C,OAAO,IAAI,wBAAwB,CAAC;YAClC,eAAe,EAAE,IAAI,mBAAS,CAAC,GAAG,CAAC,eAAe,CAAC;YACnD,cAAc,EAAE,IAAI,mBAAS,CAAC,GAAG,CAAC,cAAc,CAAC;SAClD,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,OAAO,wBAAwB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACnD,CAAC;CACF;AA9CD,4DA8CC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import BN from "bn.js";
|
|
2
|
+
import { PriceHeuristic, PriceHeuristicFields, PriceHeuristicJSON } from "./PriceHeuristic";
|
|
3
|
+
import { ScopeConfiguration, ScopeConfigurationFields, ScopeConfigurationJSON } from "./ScopeConfiguration";
|
|
4
|
+
import { SwitchboardConfiguration, SwitchboardConfigurationFields, SwitchboardConfigurationJSON } from "./SwitchboardConfiguration";
|
|
5
|
+
import { PythConfiguration, PythConfigurationFields, PythConfigurationJSON } from "./PythConfiguration";
|
|
6
|
+
export interface TokenInfoFields {
|
|
7
|
+
/** UTF-8 encoded name of the token (null-terminated) */
|
|
8
|
+
name: Array<number>;
|
|
9
|
+
/** Heuristics limits of acceptable price */
|
|
10
|
+
heuristic: PriceHeuristicFields;
|
|
11
|
+
/** Max divergence between twap and price in bps */
|
|
12
|
+
maxTwapDivergenceBps: BN;
|
|
13
|
+
maxAgePriceSeconds: BN;
|
|
14
|
+
maxAgeTwapSeconds: BN;
|
|
15
|
+
/** Scope price configuration */
|
|
16
|
+
scopeConfiguration: ScopeConfigurationFields;
|
|
17
|
+
/** Switchboard configuration */
|
|
18
|
+
switchboardConfiguration: SwitchboardConfigurationFields;
|
|
19
|
+
/** Pyth configuration */
|
|
20
|
+
pythConfiguration: PythConfigurationFields;
|
|
21
|
+
blockPriceUsage: number;
|
|
22
|
+
reserved: Array<number>;
|
|
23
|
+
padding: Array<BN>;
|
|
24
|
+
}
|
|
25
|
+
export interface TokenInfoJSON {
|
|
26
|
+
/** UTF-8 encoded name of the token (null-terminated) */
|
|
27
|
+
name: Array<number>;
|
|
28
|
+
/** Heuristics limits of acceptable price */
|
|
29
|
+
heuristic: PriceHeuristicJSON;
|
|
30
|
+
/** Max divergence between twap and price in bps */
|
|
31
|
+
maxTwapDivergenceBps: string;
|
|
32
|
+
maxAgePriceSeconds: string;
|
|
33
|
+
maxAgeTwapSeconds: string;
|
|
34
|
+
/** Scope price configuration */
|
|
35
|
+
scopeConfiguration: ScopeConfigurationJSON;
|
|
36
|
+
/** Switchboard configuration */
|
|
37
|
+
switchboardConfiguration: SwitchboardConfigurationJSON;
|
|
38
|
+
/** Pyth configuration */
|
|
39
|
+
pythConfiguration: PythConfigurationJSON;
|
|
40
|
+
blockPriceUsage: number;
|
|
41
|
+
reserved: Array<number>;
|
|
42
|
+
padding: Array<string>;
|
|
43
|
+
}
|
|
44
|
+
export declare class TokenInfo {
|
|
45
|
+
/** UTF-8 encoded name of the token (null-terminated) */
|
|
46
|
+
readonly name: Array<number>;
|
|
47
|
+
/** Heuristics limits of acceptable price */
|
|
48
|
+
readonly heuristic: PriceHeuristic;
|
|
49
|
+
/** Max divergence between twap and price in bps */
|
|
50
|
+
readonly maxTwapDivergenceBps: BN;
|
|
51
|
+
readonly maxAgePriceSeconds: BN;
|
|
52
|
+
readonly maxAgeTwapSeconds: BN;
|
|
53
|
+
/** Scope price configuration */
|
|
54
|
+
readonly scopeConfiguration: ScopeConfiguration;
|
|
55
|
+
/** Switchboard configuration */
|
|
56
|
+
readonly switchboardConfiguration: SwitchboardConfiguration;
|
|
57
|
+
/** Pyth configuration */
|
|
58
|
+
readonly pythConfiguration: PythConfiguration;
|
|
59
|
+
readonly blockPriceUsage: number;
|
|
60
|
+
readonly reserved: Array<number>;
|
|
61
|
+
readonly padding: Array<BN>;
|
|
62
|
+
constructor(fields: TokenInfoFields);
|
|
63
|
+
static layout(property?: string): any;
|
|
64
|
+
static fromDecoded(obj: any): TokenInfo;
|
|
65
|
+
static toEncodable(fields: TokenInfoFields): {
|
|
66
|
+
name: number[];
|
|
67
|
+
heuristic: {
|
|
68
|
+
lower: BN;
|
|
69
|
+
upper: BN;
|
|
70
|
+
/** Max divergence between twap and price in bps */
|
|
71
|
+
exp: BN;
|
|
72
|
+
};
|
|
73
|
+
maxTwapDivergenceBps: BN;
|
|
74
|
+
maxAgePriceSeconds: BN;
|
|
75
|
+
maxAgeTwapSeconds: BN;
|
|
76
|
+
scopeConfiguration: {
|
|
77
|
+
priceFeed: import("@solana/web3.js").PublicKey;
|
|
78
|
+
priceChain: number[];
|
|
79
|
+
twapChain: number[]; /** Heuristics limits of acceptable price */
|
|
80
|
+
};
|
|
81
|
+
switchboardConfiguration: {
|
|
82
|
+
priceAggregator: import("@solana/web3.js").PublicKey;
|
|
83
|
+
twapAggregator: import("@solana/web3.js").PublicKey;
|
|
84
|
+
};
|
|
85
|
+
pythConfiguration: {
|
|
86
|
+
price: import("@solana/web3.js").PublicKey;
|
|
87
|
+
};
|
|
88
|
+
blockPriceUsage: number;
|
|
89
|
+
reserved: number[];
|
|
90
|
+
padding: BN[];
|
|
91
|
+
};
|
|
92
|
+
toJSON(): TokenInfoJSON;
|
|
93
|
+
static fromJSON(obj: TokenInfoJSON): TokenInfo;
|
|
94
|
+
toEncodable(): {
|
|
95
|
+
name: number[];
|
|
96
|
+
heuristic: {
|
|
97
|
+
lower: BN;
|
|
98
|
+
upper: BN;
|
|
99
|
+
/** Max divergence between twap and price in bps */
|
|
100
|
+
exp: BN;
|
|
101
|
+
};
|
|
102
|
+
maxTwapDivergenceBps: BN;
|
|
103
|
+
maxAgePriceSeconds: BN;
|
|
104
|
+
maxAgeTwapSeconds: BN;
|
|
105
|
+
scopeConfiguration: {
|
|
106
|
+
priceFeed: import("@solana/web3.js").PublicKey;
|
|
107
|
+
priceChain: number[];
|
|
108
|
+
twapChain: number[]; /** Heuristics limits of acceptable price */
|
|
109
|
+
};
|
|
110
|
+
switchboardConfiguration: {
|
|
111
|
+
priceAggregator: import("@solana/web3.js").PublicKey;
|
|
112
|
+
twapAggregator: import("@solana/web3.js").PublicKey;
|
|
113
|
+
};
|
|
114
|
+
pythConfiguration: {
|
|
115
|
+
price: import("@solana/web3.js").PublicKey;
|
|
116
|
+
};
|
|
117
|
+
blockPriceUsage: number;
|
|
118
|
+
reserved: number[];
|
|
119
|
+
padding: BN[];
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.TokenInfo = void 0;
|
|
30
|
+
const bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
31
|
+
const borsh = __importStar(require("@coral-xyz/borsh"));
|
|
32
|
+
const PriceHeuristic_1 = require("./PriceHeuristic");
|
|
33
|
+
const ScopeConfiguration_1 = require("./ScopeConfiguration");
|
|
34
|
+
const SwitchboardConfiguration_1 = require("./SwitchboardConfiguration");
|
|
35
|
+
const PythConfiguration_1 = require("./PythConfiguration");
|
|
36
|
+
class TokenInfo {
|
|
37
|
+
/** UTF-8 encoded name of the token (null-terminated) */
|
|
38
|
+
name;
|
|
39
|
+
/** Heuristics limits of acceptable price */
|
|
40
|
+
heuristic;
|
|
41
|
+
/** Max divergence between twap and price in bps */
|
|
42
|
+
maxTwapDivergenceBps;
|
|
43
|
+
maxAgePriceSeconds;
|
|
44
|
+
maxAgeTwapSeconds;
|
|
45
|
+
/** Scope price configuration */
|
|
46
|
+
scopeConfiguration;
|
|
47
|
+
/** Switchboard configuration */
|
|
48
|
+
switchboardConfiguration;
|
|
49
|
+
/** Pyth configuration */
|
|
50
|
+
pythConfiguration;
|
|
51
|
+
blockPriceUsage;
|
|
52
|
+
reserved;
|
|
53
|
+
padding;
|
|
54
|
+
constructor(fields) {
|
|
55
|
+
this.name = fields.name;
|
|
56
|
+
this.heuristic = new PriceHeuristic_1.PriceHeuristic({ ...fields.heuristic });
|
|
57
|
+
this.maxTwapDivergenceBps = fields.maxTwapDivergenceBps;
|
|
58
|
+
this.maxAgePriceSeconds = fields.maxAgePriceSeconds;
|
|
59
|
+
this.maxAgeTwapSeconds = fields.maxAgeTwapSeconds;
|
|
60
|
+
this.scopeConfiguration = new ScopeConfiguration_1.ScopeConfiguration({
|
|
61
|
+
...fields.scopeConfiguration,
|
|
62
|
+
});
|
|
63
|
+
this.switchboardConfiguration = new SwitchboardConfiguration_1.SwitchboardConfiguration({
|
|
64
|
+
...fields.switchboardConfiguration,
|
|
65
|
+
});
|
|
66
|
+
this.pythConfiguration = new PythConfiguration_1.PythConfiguration({
|
|
67
|
+
...fields.pythConfiguration,
|
|
68
|
+
});
|
|
69
|
+
this.blockPriceUsage = fields.blockPriceUsage;
|
|
70
|
+
this.reserved = fields.reserved;
|
|
71
|
+
this.padding = fields.padding;
|
|
72
|
+
}
|
|
73
|
+
static layout(property) {
|
|
74
|
+
return borsh.struct([
|
|
75
|
+
borsh.array(borsh.u8(), 32, "name"),
|
|
76
|
+
PriceHeuristic_1.PriceHeuristic.layout("heuristic"),
|
|
77
|
+
borsh.u64("maxTwapDivergenceBps"),
|
|
78
|
+
borsh.u64("maxAgePriceSeconds"),
|
|
79
|
+
borsh.u64("maxAgeTwapSeconds"),
|
|
80
|
+
ScopeConfiguration_1.ScopeConfiguration.layout("scopeConfiguration"),
|
|
81
|
+
SwitchboardConfiguration_1.SwitchboardConfiguration.layout("switchboardConfiguration"),
|
|
82
|
+
PythConfiguration_1.PythConfiguration.layout("pythConfiguration"),
|
|
83
|
+
borsh.u8("blockPriceUsage"),
|
|
84
|
+
borsh.array(borsh.u8(), 7, "reserved"),
|
|
85
|
+
borsh.array(borsh.u64(), 19, "padding"),
|
|
86
|
+
], property);
|
|
87
|
+
}
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
+
static fromDecoded(obj) {
|
|
90
|
+
return new TokenInfo({
|
|
91
|
+
name: obj.name,
|
|
92
|
+
heuristic: PriceHeuristic_1.PriceHeuristic.fromDecoded(obj.heuristic),
|
|
93
|
+
maxTwapDivergenceBps: obj.maxTwapDivergenceBps,
|
|
94
|
+
maxAgePriceSeconds: obj.maxAgePriceSeconds,
|
|
95
|
+
maxAgeTwapSeconds: obj.maxAgeTwapSeconds,
|
|
96
|
+
scopeConfiguration: ScopeConfiguration_1.ScopeConfiguration.fromDecoded(obj.scopeConfiguration),
|
|
97
|
+
switchboardConfiguration: SwitchboardConfiguration_1.SwitchboardConfiguration.fromDecoded(obj.switchboardConfiguration),
|
|
98
|
+
pythConfiguration: PythConfiguration_1.PythConfiguration.fromDecoded(obj.pythConfiguration),
|
|
99
|
+
blockPriceUsage: obj.blockPriceUsage,
|
|
100
|
+
reserved: obj.reserved,
|
|
101
|
+
padding: obj.padding,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
static toEncodable(fields) {
|
|
105
|
+
return {
|
|
106
|
+
name: fields.name,
|
|
107
|
+
heuristic: PriceHeuristic_1.PriceHeuristic.toEncodable(fields.heuristic),
|
|
108
|
+
maxTwapDivergenceBps: fields.maxTwapDivergenceBps,
|
|
109
|
+
maxAgePriceSeconds: fields.maxAgePriceSeconds,
|
|
110
|
+
maxAgeTwapSeconds: fields.maxAgeTwapSeconds,
|
|
111
|
+
scopeConfiguration: ScopeConfiguration_1.ScopeConfiguration.toEncodable(fields.scopeConfiguration),
|
|
112
|
+
switchboardConfiguration: SwitchboardConfiguration_1.SwitchboardConfiguration.toEncodable(fields.switchboardConfiguration),
|
|
113
|
+
pythConfiguration: PythConfiguration_1.PythConfiguration.toEncodable(fields.pythConfiguration),
|
|
114
|
+
blockPriceUsage: fields.blockPriceUsage,
|
|
115
|
+
reserved: fields.reserved,
|
|
116
|
+
padding: fields.padding,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
toJSON() {
|
|
120
|
+
return {
|
|
121
|
+
name: this.name,
|
|
122
|
+
heuristic: this.heuristic.toJSON(),
|
|
123
|
+
maxTwapDivergenceBps: this.maxTwapDivergenceBps.toString(),
|
|
124
|
+
maxAgePriceSeconds: this.maxAgePriceSeconds.toString(),
|
|
125
|
+
maxAgeTwapSeconds: this.maxAgeTwapSeconds.toString(),
|
|
126
|
+
scopeConfiguration: this.scopeConfiguration.toJSON(),
|
|
127
|
+
switchboardConfiguration: this.switchboardConfiguration.toJSON(),
|
|
128
|
+
pythConfiguration: this.pythConfiguration.toJSON(),
|
|
129
|
+
blockPriceUsage: this.blockPriceUsage,
|
|
130
|
+
reserved: this.reserved,
|
|
131
|
+
padding: this.padding.map((item) => item.toString()),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
static fromJSON(obj) {
|
|
135
|
+
return new TokenInfo({
|
|
136
|
+
name: obj.name,
|
|
137
|
+
heuristic: PriceHeuristic_1.PriceHeuristic.fromJSON(obj.heuristic),
|
|
138
|
+
maxTwapDivergenceBps: new bn_js_1.default(obj.maxTwapDivergenceBps),
|
|
139
|
+
maxAgePriceSeconds: new bn_js_1.default(obj.maxAgePriceSeconds),
|
|
140
|
+
maxAgeTwapSeconds: new bn_js_1.default(obj.maxAgeTwapSeconds),
|
|
141
|
+
scopeConfiguration: ScopeConfiguration_1.ScopeConfiguration.fromJSON(obj.scopeConfiguration),
|
|
142
|
+
switchboardConfiguration: SwitchboardConfiguration_1.SwitchboardConfiguration.fromJSON(obj.switchboardConfiguration),
|
|
143
|
+
pythConfiguration: PythConfiguration_1.PythConfiguration.fromJSON(obj.pythConfiguration),
|
|
144
|
+
blockPriceUsage: obj.blockPriceUsage,
|
|
145
|
+
reserved: obj.reserved,
|
|
146
|
+
padding: obj.padding.map((item) => new bn_js_1.default(item)),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
toEncodable() {
|
|
150
|
+
return TokenInfo.toEncodable(this);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.TokenInfo = TokenInfo;
|
|
154
|
+
//# sourceMappingURL=TokenInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenInfo.js","sourceRoot":"","sources":["../../src/types/TokenInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAsB,CAAC,wDAAwD;AAC/E,wDAAyC;AACzC,qDAA2F;AAC3F,6DAA2G;AAC3G,yEAImC;AACnC,2DAAuG;AA0CvG,MAAa,SAAS;IACpB,wDAAwD;IAC/C,IAAI,CAAe;IAC5B,4CAA4C;IACnC,SAAS,CAAgB;IAClC,mDAAmD;IAC1C,oBAAoB,CAAI;IACxB,kBAAkB,CAAI;IACtB,iBAAiB,CAAI;IAC9B,gCAAgC;IACvB,kBAAkB,CAAoB;IAC/C,gCAAgC;IACvB,wBAAwB,CAA0B;IAC3D,yBAAyB;IAChB,iBAAiB,CAAmB;IACpC,eAAe,CAAQ;IACvB,QAAQ,CAAe;IACvB,OAAO,CAAW;IAE3B,YAAY,MAAuB;QACjC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,+BAAc,CAAC,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;QAC5D,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAA;QACvD,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAA;QACnD,IAAI,CA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AC;YACvE,wBAAwB,EAAE,mDAAwB,CAAC,QAAQ,CAAC,GAAG,CAAC,wBAAwB,CAAC;YACzF,iBAAiB,EAAE,qCAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC;YACpE,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAE,CAAC,IAAI,CAAC,CAAC;SACjD,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;CACF;AA9HD,8BA8HC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import BN from "bn.js";
|
|
2
|
+
export interface WithdrawalCapsFields {
|
|
3
|
+
configCapacity: BN;
|
|
4
|
+
currentTotal: BN;
|
|
5
|
+
lastIntervalStartTimestamp: BN;
|
|
6
|
+
configIntervalLengthSeconds: BN;
|
|
7
|
+
}
|
|
8
|
+
export interface WithdrawalCapsJSON {
|
|
9
|
+
configCapacity: string;
|
|
10
|
+
currentTotal: string;
|
|
11
|
+
lastIntervalStartTimestamp: string;
|
|
12
|
+
configIntervalLengthSeconds: string;
|
|
13
|
+
}
|
|
14
|
+
/** Reserve Withdrawal Caps State */
|
|
15
|
+
export declare class WithdrawalCaps {
|
|
16
|
+
readonly configCapacity: BN;
|
|
17
|
+
readonly currentTotal: BN;
|
|
18
|
+
readonly lastIntervalStartTimestamp: BN;
|
|
19
|
+
readonly configIntervalLengthSeconds: BN;
|
|
20
|
+
constructor(fields: WithdrawalCapsFields);
|
|
21
|
+
static layout(property?: string): any;
|
|
22
|
+
static fromDecoded(obj: any): WithdrawalCaps;
|
|
23
|
+
static toEncodable(fields: WithdrawalCapsFields): {
|
|
24
|
+
configCapacity: BN;
|
|
25
|
+
currentTotal: BN;
|
|
26
|
+
lastIntervalStartTimestamp: BN;
|
|
27
|
+
configIntervalLengthSeconds: BN;
|
|
28
|
+
};
|
|
29
|
+
toJSON(): WithdrawalCapsJSON;
|
|
30
|
+
static fromJSON(obj: WithdrawalCapsJSON): WithdrawalCaps;
|
|
31
|
+
toEncodable(): {
|
|
32
|
+
configCapacity: BN;
|
|
33
|
+
currentTotal: BN;
|
|
34
|
+
lastIntervalStartTimestamp: BN;
|
|
35
|
+
configIntervalLengthSeconds: BN;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.WithdrawalCaps = void 0;
|
|
30
|
+
const bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
31
|
+
const borsh = __importStar(require("@coral-xyz/borsh"));
|
|
32
|
+
/** Reserve Withdrawal Caps State */
|
|
33
|
+
class WithdrawalCaps {
|
|
34
|
+
configCapacity;
|
|
35
|
+
currentTotal;
|
|
36
|
+
lastIntervalStartTimestamp;
|
|
37
|
+
configIntervalLengthSeconds;
|
|
38
|
+
constructor(fields) {
|
|
39
|
+
this.configCapacity = fields.configCapacity;
|
|
40
|
+
this.currentTotal = fields.currentTotal;
|
|
41
|
+
this.lastIntervalStartTimestamp = fields.lastIntervalStartTimestamp;
|
|
42
|
+
this.configIntervalLengthSeconds = fields.configIntervalLengthSeconds;
|
|
43
|
+
}
|
|
44
|
+
static layout(property) {
|
|
45
|
+
return borsh.struct([
|
|
46
|
+
borsh.i64("configCapacity"),
|
|
47
|
+
borsh.i64("currentTotal"),
|
|
48
|
+
borsh.u64("lastIntervalStartTimestamp"),
|
|
49
|
+
borsh.u64("configIntervalLengthSeconds"),
|
|
50
|
+
], property);
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
static fromDecoded(obj) {
|
|
54
|
+
return new WithdrawalCaps({
|
|
55
|
+
configCapacity: obj.configCapacity,
|
|
56
|
+
currentTotal: obj.currentTotal,
|
|
57
|
+
lastIntervalStartTimestamp: obj.lastIntervalStartTimestamp,
|
|
58
|
+
configIntervalLengthSeconds: obj.configIntervalLengthSeconds,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
static toEncodable(fields) {
|
|
62
|
+
return {
|
|
63
|
+
configCapacity: fields.configCapacity,
|
|
64
|
+
currentTotal: fields.currentTotal,
|
|
65
|
+
lastIntervalStartTimestamp: fields.lastIntervalStartTimestamp,
|
|
66
|
+
configIntervalLengthSeconds: fields.configIntervalLengthSeconds,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
toJSON() {
|
|
70
|
+
return {
|
|
71
|
+
configCapacity: this.configCapacity.toString(),
|
|
72
|
+
currentTotal: this.currentTotal.toString(),
|
|
73
|
+
lastIntervalStartTimestamp: this.lastIntervalStartTimestamp.toString(),
|
|
74
|
+
configIntervalLengthSeconds: this.configIntervalLengthSeconds.toString(),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static fromJSON(obj) {
|
|
78
|
+
return new WithdrawalCaps({
|
|
79
|
+
configCapacity: new bn_js_1.default(obj.configCapacity),
|
|
80
|
+
currentTotal: new bn_js_1.default(obj.currentTotal),
|
|
81
|
+
lastIntervalStartTimestamp: new bn_js_1.default(obj.lastIntervalStartTimestamp),
|
|
82
|
+
configIntervalLengthSeconds: new bn_js_1.default(obj.configIntervalLengthSeconds),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
toEncodable() {
|
|
86
|
+
return WithdrawalCaps.toEncodable(this);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.WithdrawalCaps = WithdrawalCaps;
|
|
90
|
+
//# sourceMappingURL=WithdrawalCaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithdrawalCaps.js","sourceRoot":"","sources":["../../src/types/WithdrawalCaps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAsB,CAAC,wDAAwD;AAC/E,wDAAyC;AAgBzC,oCAAoC;AACpC,MAAa,cAAc;IAChB,cAAc,CAAI;IAClB,YAAY,CAAI;IAChB,0BAA0B,CAAI;IAC9B,2BAA2B,CAAI;IAExC,YAAY,MAA4B;QACtC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,IAAI,CAAC,YAAY,GAAG,MAAM,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,CAAC,GAAuB;QACrC,OAAO,IAAI,cAAc,CAAC;YACxB,cAAc,EAAE,IAAI,eAAE,CAAC,GAAG,CAAC,cAAc,CAAC;YAC1C,YAAY,EAAE,IAAI,eAAE,CAAC,GAAG,CAAC,YAAY,CAAC;YACtC,0BAA0B,EAAE,IAAI,eAAE,CAAC,GAAG,CAAC,0BAA0B,CAAC;YAClE,2BAA2B,EAAE,IAAI,eAAE,CAAC,GAAG,CAAC,2BAA2B,CAAC;SACrE,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,OAAO,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACzC,CAAC;CACF;AAjED,wCAiEC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import BN from "bn.js";
|
|
2
|
+
export interface LastUpdateFields {
|
|
3
|
+
/** Last slot when updated */
|
|
4
|
+
slot: BN;
|
|
5
|
+
/** True when marked stale, false when slot updated */
|
|
6
|
+
stale: number;
|
|
7
|
+
/** Status of the prices used to calculate the last update */
|
|
8
|
+
priceStatus: number;
|
|
9
|
+
placeholder: Array<number>;
|
|
10
|
+
}
|
|
11
|
+
export interface LastUpdateJSON {
|
|
12
|
+
/** Last slot when updated */
|
|
13
|
+
slot: string;
|
|
14
|
+
/** True when marked stale, false when slot updated */
|
|
15
|
+
stale: number;
|
|
16
|
+
/** Status of the prices used to calculate the last update */
|
|
17
|
+
priceStatus: number;
|
|
18
|
+
placeholder: Array<number>;
|
|
19
|
+
}
|
|
20
|
+
/** Last update state */
|
|
21
|
+
export declare class LastUpdate {
|
|
22
|
+
/** Last slot when updated */
|
|
23
|
+
readonly slot: BN;
|
|
24
|
+
/** True when marked stale, false when slot updated */
|
|
25
|
+
readonly stale: number;
|
|
26
|
+
/** Status of the prices used to calculate the last update */
|
|
27
|
+
readonly priceStatus: number;
|
|
28
|
+
readonly placeholder: Array<number>;
|
|
29
|
+
constructor(fields: LastUpdateFields);
|
|
30
|
+
static layout(property?: string): any;
|
|
31
|
+
static fromDecoded(obj: any): LastUpdate;
|
|
32
|
+
static toEncodable(fields: LastUpdateFields): {
|
|
33
|
+
slot: BN;
|
|
34
|
+
stale: number;
|
|
35
|
+
priceStatus: number;
|
|
36
|
+
placeholder: number[];
|
|
37
|
+
};
|
|
38
|
+
toJSON(): LastUpdateJSON;
|
|
39
|
+
static fromJSON(obj: LastUpdateJSON): LastUpdate;
|
|
40
|
+
toEncodable(): {
|
|
41
|
+
slot: BN;
|
|
42
|
+
stale: number;
|
|
43
|
+
priceStatus: number;
|
|
44
|
+
placeholder: number[];
|
|
45
|
+
};
|
|
46
|
+
}
|