@the-situation/abi 0.5.0-alpha.0 → 0.8.4
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/amm.d.ts +26 -41
- package/dist/amm.d.ts.map +1 -1
- package/dist/amm.js +13 -19
- package/dist/amm.js.map +1 -1
- package/dist/common.d.ts +120 -289
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +40 -64
- package/dist/common.js.map +1 -1
- package/dist/events.d.ts +204 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +10 -0
- package/dist/events.js.map +1 -0
- package/dist/factory.d.ts +85 -22
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +61 -15
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -9
- package/dist/index.js.map +1 -1
- package/dist/math-runtime.d.ts +173 -0
- package/dist/math-runtime.d.ts.map +1 -0
- package/dist/math-runtime.js +36 -0
- package/dist/math-runtime.js.map +1 -0
- package/dist/multinoulli.d.ts +197 -0
- package/dist/multinoulli.d.ts.map +1 -0
- package/dist/multinoulli.js +114 -0
- package/dist/multinoulli.js.map +1 -0
- package/package.json +5 -3
- package/dist/math-library.d.ts +0 -92
- package/dist/math-library.d.ts.map +0 -1
- package/dist/math-library.js +0 -20
- package/dist/math-library.js.map +0 -1
package/dist/amm.d.ts
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AMM contract ABI types and function names.
|
|
3
|
-
*
|
|
4
|
-
* These match the latest `normal_amm` interface.
|
|
2
|
+
* Normal AMM contract ABI types and function names (v0.8.0).
|
|
5
3
|
*
|
|
6
4
|
* @module
|
|
7
5
|
*/
|
|
8
6
|
import type { NormalDistributionRaw, SQ128x128Raw } from '@the-situation/core';
|
|
9
|
-
import type { AmmConfigRaw, AmmParamsRaw, ClaimResultRaw, FeeConfigRaw, LPInfoRaw, MarketStatusRaw, NormalSqrtHintsRaw,
|
|
10
|
-
|
|
11
|
-
* All AMM contract function names.
|
|
12
|
-
*/
|
|
13
|
-
export declare const AMM_FUNCTION_NAMES: readonly ["get_params", "get_config", "get_distribution", "get_market_status", "get_owner", "get_admin", "get_position_extended", "get_position_compact", "get_lp_info", "get_distribution_hints", "get_lp_shares", "get_position_settlement_status", "get_extension", "get_extension_call_points", "get_market_key", "get_metadata_hash", "get_math_class_hash", "get_fee_config", "get_accumulated_protocol_fees", "get_token_balance", "execute_trade", "check_close_position", "close_position", "close_position_guarded", "claim", "add_liquidity", "remove_liquidity", "initialize", "pause", "unpause", "settle", "update_parameters", "transfer_ownership", "update_admin", "update_math_class_hash", "withdraw_protocol_fees", "emergency_withdraw", "clear_tokens"];
|
|
7
|
+
import type { AmmConfigRaw, AmmParamsRaw, ClaimResultRaw, FeeConfigRaw, LPInfoRaw, MarketStatusRaw, NormalSqrtHintsRaw, PositionCompactRaw, PositionSellResultRaw, PositionSummaryRaw, TradeExecutionRaw } from './common';
|
|
8
|
+
export declare const AMM_FUNCTION_NAMES: readonly ["get_params", "get_config", "get_distribution", "get_market_status", "get_owner", "get_admin", "get_runtime_class_hash", "get_extension", "get_extension_call_points", "get_metadata_hash", "get_position_summary", "get_position_compact", "get_lp_info", "get_distribution_hints", "get_lp_shares", "get_pending_settlement_claim_count", "get_market_key", "get_fee_config", "get_accumulated_protocol_fees", "execute_trade", "check_sell_position", "sell_position_guarded", "claim", "claim_for", "add_liquidity", "remove_liquidity", "initialize", "pause", "unpause", "settle", "update_parameters", "transfer_ownership", "update_admin", "update_runtime_class_hash", "withdraw_protocol_fees", "emergency_withdraw", "clear_tokens"];
|
|
14
9
|
export type AmmFunctionName = (typeof AMM_FUNCTION_NAMES)[number];
|
|
15
|
-
/**
|
|
16
|
-
* Input for execute_trade.
|
|
17
|
-
*/
|
|
18
10
|
export interface TradeInput {
|
|
19
11
|
readonly candidate: NormalDistributionRaw;
|
|
20
12
|
readonly xStar: SQ128x128Raw;
|
|
21
13
|
readonly suppliedCollateral: SQ128x128Raw;
|
|
22
14
|
readonly candidateHints: NormalSqrtHintsRaw;
|
|
23
15
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Input for update_parameters.
|
|
26
|
-
*/
|
|
27
16
|
export interface UpdateParametersInput {
|
|
28
17
|
readonly tolerance: SQ128x128Raw;
|
|
29
18
|
readonly minTradeCollateral: SQ128x128Raw;
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
export interface MarketKey {
|
|
21
|
+
readonly collateralToken: string;
|
|
22
|
+
readonly initialDistribution: NormalDistributionRaw;
|
|
23
|
+
readonly k: SQ128x128Raw;
|
|
24
|
+
readonly initialBacking: SQ128x128Raw;
|
|
25
|
+
readonly extension: string;
|
|
26
|
+
readonly metadataHash: string;
|
|
27
|
+
}
|
|
34
28
|
export interface AmmViewReturns {
|
|
35
29
|
get_params: AmmParamsRaw;
|
|
36
30
|
get_config: AmmConfigRaw;
|
|
@@ -38,46 +32,37 @@ export interface AmmViewReturns {
|
|
|
38
32
|
get_market_status: MarketStatusRaw;
|
|
39
33
|
get_owner: string;
|
|
40
34
|
get_admin: string;
|
|
41
|
-
|
|
35
|
+
get_runtime_class_hash: string;
|
|
36
|
+
get_extension: string;
|
|
37
|
+
get_extension_call_points: number;
|
|
38
|
+
get_metadata_hash: string;
|
|
39
|
+
get_position_summary: PositionSummaryRaw;
|
|
42
40
|
get_position_compact: PositionCompactRaw;
|
|
43
41
|
get_lp_info: LPInfoRaw;
|
|
44
42
|
get_distribution_hints: NormalSqrtHintsRaw;
|
|
45
43
|
get_lp_shares: SQ128x128Raw;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get_extension_call_points: unknown;
|
|
49
|
-
get_market_key: bigint;
|
|
50
|
-
get_metadata_hash: string;
|
|
51
|
-
get_math_class_hash: string;
|
|
44
|
+
get_pending_settlement_claim_count: bigint;
|
|
45
|
+
get_market_key: MarketKey;
|
|
52
46
|
get_fee_config: FeeConfigRaw;
|
|
53
47
|
get_accumulated_protocol_fees: bigint;
|
|
54
|
-
get_token_balance: bigint;
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export interface AmmCloseReturns {
|
|
60
|
-
check_close_position: PositionCloseResultRaw;
|
|
61
|
-
close_position: PositionCloseResultRaw;
|
|
62
|
-
close_position_guarded: PositionCloseResultRaw;
|
|
49
|
+
export interface AmmSellReturns {
|
|
50
|
+
check_sell_position: PositionSellResultRaw;
|
|
51
|
+
sell_position_guarded: PositionSellResultRaw;
|
|
63
52
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Return type mapping for AMM trade functions.
|
|
66
|
-
*/
|
|
67
53
|
export interface AmmTradeReturns {
|
|
68
54
|
execute_trade: TradeExecutionRaw;
|
|
69
55
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Return type mapping for AMM LP functions.
|
|
72
|
-
*/
|
|
73
56
|
export interface AmmLPReturns {
|
|
74
57
|
add_liquidity: bigint;
|
|
75
58
|
remove_liquidity: bigint;
|
|
76
59
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Return type mapping for AMM settlement functions.
|
|
79
|
-
*/
|
|
80
60
|
export interface AmmSettlementReturns {
|
|
81
61
|
claim: ClaimResultRaw;
|
|
62
|
+
claim_for: ClaimResultRaw;
|
|
82
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `AmmSellReturns` instead.
|
|
66
|
+
*/
|
|
67
|
+
export type AmmCloseReturns = AmmSellReturns;
|
|
83
68
|
//# sourceMappingURL=amm.d.ts.map
|
package/dist/amm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm.d.ts","sourceRoot":"","sources":["../src/amm.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"amm.d.ts","sourceRoot":"","sources":["../src/amm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK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AAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,WAAW,EAAE,SAAS,CAAC;IACvB,sBAAsB,EAAE,kBAAkB,CAAC;IAC3C,aAAa,EAAE,YAAY,CAAC;IAC5B,kCAAkC,EAAE,MAAM,CAAC;IAC3C,cAAc,EAAE,SAAS,CAAC;IAC1B,cAAc,EAAE,YAAY,CAAC;IAC7B,6BAA6B,EAAE,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,mBAAmB,EAAE,qBAAqB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC"}
|
package/dist/amm.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AMM contract ABI types and function names.
|
|
3
|
-
*
|
|
4
|
-
* These match the latest `normal_amm` interface.
|
|
2
|
+
* Normal AMM contract ABI types and function names (v0.8.0).
|
|
5
3
|
*
|
|
6
4
|
* @module
|
|
7
5
|
*/
|
|
8
6
|
// ============================================================================
|
|
9
7
|
// Function Names
|
|
10
8
|
// ============================================================================
|
|
11
|
-
/**
|
|
12
|
-
* All AMM contract function names.
|
|
13
|
-
*/
|
|
14
9
|
export const AMM_FUNCTION_NAMES = [
|
|
15
10
|
// View functions
|
|
16
11
|
'get_params',
|
|
@@ -19,27 +14,26 @@ export const AMM_FUNCTION_NAMES = [
|
|
|
19
14
|
'get_market_status',
|
|
20
15
|
'get_owner',
|
|
21
16
|
'get_admin',
|
|
22
|
-
'
|
|
17
|
+
'get_runtime_class_hash',
|
|
18
|
+
'get_extension',
|
|
19
|
+
'get_extension_call_points',
|
|
20
|
+
'get_metadata_hash',
|
|
21
|
+
'get_position_summary',
|
|
23
22
|
'get_position_compact',
|
|
24
23
|
'get_lp_info',
|
|
25
24
|
'get_distribution_hints',
|
|
26
25
|
'get_lp_shares',
|
|
27
|
-
'
|
|
28
|
-
'get_extension',
|
|
29
|
-
'get_extension_call_points',
|
|
26
|
+
'get_pending_settlement_claim_count',
|
|
30
27
|
'get_market_key',
|
|
31
|
-
'get_metadata_hash',
|
|
32
|
-
'get_math_class_hash',
|
|
33
28
|
'get_fee_config',
|
|
34
29
|
'get_accumulated_protocol_fees',
|
|
35
|
-
|
|
36
|
-
// Trade / close
|
|
30
|
+
// Trade / sell
|
|
37
31
|
'execute_trade',
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
|
|
41
|
-
// Position settlement
|
|
32
|
+
'check_sell_position',
|
|
33
|
+
'sell_position_guarded',
|
|
34
|
+
// Settlement
|
|
42
35
|
'claim',
|
|
36
|
+
'claim_for',
|
|
43
37
|
// LP
|
|
44
38
|
'add_liquidity',
|
|
45
39
|
'remove_liquidity',
|
|
@@ -51,7 +45,7 @@ export const AMM_FUNCTION_NAMES = [
|
|
|
51
45
|
'update_parameters',
|
|
52
46
|
'transfer_ownership',
|
|
53
47
|
'update_admin',
|
|
54
|
-
'
|
|
48
|
+
'update_runtime_class_hash',
|
|
55
49
|
// Fee / emergency
|
|
56
50
|
'withdraw_protocol_fees',
|
|
57
51
|
'emergency_withdraw',
|
package/dist/amm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm.js","sourceRoot":"","sources":["../src/amm.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"amm.js","sourceRoot":"","sources":["../src/amm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,iBAAiB;IACjB,YAAY;IACZ,YAAY;IACZ,kBAAkB;IAClB,mBAAmB;IACnB,WAAW;IACX,WAAW;IACX,wBAAwB;IACxB,eAAe;IACf,2BAA2B;IAC3B,mBAAmB;IACnB,sBAAsB;IACtB,sBAAsB;IACtB,aAAa;IACb,wBAAwB;IACxB,eAAe;IACf,oCAAoC;IACpC,gBAAgB;IAChB,gBAAgB;IAChB,+BAA+B;IAE/B,eAAe;IACf,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IAEvB,aAAa;IACb,OAAO;IACP,WAAW;IAEX,KAAK;IACL,eAAe;IACf,kBAAkB;IAElB,oBAAoB;IACpB,YAAY;IACZ,OAAO;IACP,SAAS;IACT,QAAQ;IACR,mBAAmB;IACnB,oBAAoB;IACpB,cAAc;IACd,2BAA2B;IAE3B,kBAAkB;IAClB,wBAAwB;IACxB,oBAAoB;IACpB,cAAc;CACN,CAAC"}
|