@affluent-org/sdk 0.0.2 → 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/dist/build/Account.compiled.json +1 -0
- package/dist/build/Receipt.compiled.json +1 -0
- package/dist/build/WTONWallet.compiled.json +1 -0
- package/dist/common/cache.d.ts +16 -0
- package/dist/common/cache.js +96 -0
- package/dist/common/service.d.ts +20 -0
- package/dist/common/service.js +69 -0
- package/dist/common/type.d.ts +14 -0
- package/dist/common/type.js +2 -0
- package/dist/common/unknown-contract.d.ts +14 -0
- package/dist/common/unknown-contract.js +18 -0
- package/dist/common/versions.d.ts +14 -0
- package/dist/common/versions.js +22 -0
- package/dist/constants/pool.d.ts +1 -0
- package/dist/constants/pool.js +2 -0
- package/dist/contracts/_mock/simple-oracle.d.ts +34 -0
- package/dist/contracts/_mock/simple-oracle.js +73 -0
- package/dist/contracts/vault/share-vault/type.d.ts +30 -0
- package/dist/contracts/vault/share-vault/type.js +2 -0
- package/dist/contracts/vault/strategy-vault/utils.d.ts +6 -0
- package/dist/contracts/vault/strategy-vault/utils.js +32 -0
- package/dist/factorial.d.ts +14 -0
- package/dist/factorial.js +20 -0
- package/dist/farm.d.ts +92 -0
- package/dist/farm.js +209 -0
- package/dist/monitor.d.ts +57 -0
- package/dist/monitor.js +527 -0
- package/dist/monitorCacheV1.d.ts +52 -0
- package/dist/monitorCacheV1.js +504 -0
- package/dist/oracle/oracle-v2.d.ts +39 -0
- package/dist/oracle/oracle-v2.js +151 -0
- package/dist/oracle/oracle.d.ts +107 -0
- package/dist/oracle/oracle.js +392 -0
- package/dist/periphery.d.ts +259 -0
- package/dist/periphery.js +1087 -0
- package/dist/pool.d.ts +216 -0
- package/dist/pool.js +2298 -0
- package/dist/poolCacheV1.d.ts +139 -0
- package/dist/poolCacheV1.js +1841 -0
- package/dist/rfq-auction.d.ts +75 -0
- package/dist/rfq-auction.js +220 -0
- package/dist/rfq-batch.d.ts +112 -0
- package/dist/rfq-batch.js +284 -0
- package/dist/services/share-vault/computation.d.ts +14 -17
- package/dist/services/share-vault/computation.js +39 -0
- package/dist/services/share-vault/index.js +6 -3
- package/dist/services/share-vault/query.d.ts +38 -8
- package/dist/services/share-vault/query.js +20 -27
- package/dist/services/share-vault/type.d.ts +19 -0
- package/dist/services/share-vault/type.js +2 -0
- package/dist/services/share-vault/user/index.js +3 -1
- package/dist/services/strategy-vault/computation.d.ts +1 -0
- package/dist/services/strategy-vault/computation.js +15 -0
- package/dist/services/strategy-vault/query.d.ts +147 -0
- package/dist/services/strategy-vault/query.js +67 -0
- package/dist/services/strategy-vault/type.d.ts +2 -0
- package/dist/services/strategy-vault/type.js +2 -0
- package/dist/share-vault.d.ts +91 -0
- package/dist/share-vault.js +747 -0
- package/dist/stonfi.d.ts +18 -0
- package/dist/stonfi.js +76 -0
- package/dist/strategy_vault/base.d.ts +399 -0
- package/dist/strategy_vault/base.js +1199 -0
- package/dist/strategy_vault/index.d.ts +3 -0
- package/dist/strategy_vault/index.js +7 -0
- package/dist/strategy_vault/steps.d.ts +49 -0
- package/dist/strategy_vault/steps.js +170 -0
- package/dist/types/action.d.ts +55 -0
- package/dist/types/action.js +2 -0
- package/dist/types/messages.d.ts +7 -0
- package/dist/types/messages.js +2 -0
- package/dist/types/params.d.ts +19 -0
- package/dist/types/params.js +2 -0
- package/dist/types/pool.d.ts +83 -0
- package/dist/types/pool.js +2 -0
- package/dist/types/transaction.d.ts +40 -0
- package/dist/types/transaction.js +2 -0
- package/dist/utils/_parse_temp/JumpIRM.d.ts +37 -0
- package/dist/utils/_parse_temp/JumpIRM.js +71 -0
- package/dist/utils/_parse_temp/Pool.d.ts +559 -0
- package/dist/utils/_parse_temp/Pool.js +1023 -0
- package/dist/utils/_parse_temp/ShareVault.d.ts +264 -0
- package/dist/utils/_parse_temp/ShareVault.js +479 -0
- package/dist/utils/_parse_temp/StrategyVault.d.ts +729 -0
- package/dist/utils/_parse_temp/StrategyVault.js +1865 -0
- package/dist/utils/_parse_temp/parseMsgBody.d.ts +13 -0
- package/dist/utils/_parse_temp/parseMsgBody.js +313 -0
- package/dist/utils/assert.d.ts +1 -0
- package/dist/utils/assert.js +9 -0
- package/dist/utils/client-for-parameter.d.ts +12 -0
- package/dist/utils/client-for-parameter.js +97 -0
- package/dist/utils/oracle/index.d.ts +4 -0
- package/dist/utils/oracle/index.js +19 -0
- package/dist/utils/oracle/redstone/helper.d.ts +22 -0
- package/dist/utils/oracle/redstone/helper.js +186 -0
- package/dist/utils/tracer.d.ts +13 -0
- package/dist/utils/tracer.js +137 -0
- package/dist/utils/tracker/index.d.ts +5 -0
- package/dist/utils/tracker/index.js +118 -0
- package/dist/utils/tracker/query-id-generactor.d.ts +2 -0
- package/dist/utils/tracker/query-id-generactor.js +12 -0
- package/dist/utils/tracker/type.d.ts +34 -0
- package/dist/utils/tracker/type.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "hash": "e51ae1b702b6dc0109637ce2802a1d0df407f55b9bb5500828f4eb1f43b78952", "hashBase64": "5RrhtwK23AEJY3zigCodDfQH9VubtVAIKPTrH0O3iVI=", "hex": "b5ee9c7241023701000d94000114ff00f4a413f4bcf2c80b0102016202360202c803130201200410020120050b03f3d7b68bb7ec831c02497c13816a840b434c0c05c6c30006497c0f83e900c3c248074c7c04074cfc0448860840af84b4deeb8c00860840717b870eea3888c7e1044f1c17cb8fa3d013e900c3e10d63c11fe18fc24c0a0822625a02d8244bc0ef80860841c825ff8aeb8c08d2084310ac264aeb8c097c0e103fcbc206080a01fcf8415240c705f2e3e802db3c2020d749d719fa40d31f0101d3270143306c1332208210ee555a2cba9c3032333302f180a1da40db31e002d4238210cb03bfafba9d333334344330f1809fda50db31e0238210cfc248e4ba9d333334344330f180a0da50db31e0038210cc52bae3ba9c3334344330f180a2da50db31e05b02070048d5d31301f866d30d01f867d31301f868d30d01f869d30d01f86ad30d01f86bf40430f86c019831f84113c705f2e3e8d2000101fa40fa00fa4030f8445d53210181010bf40a6fa194fa00307193307020e23001a1c801fa020281010bf441f86403915be30ef093028208989680b60912f03b0900b86d5953210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23058a0c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf441f84301f047f863004cf8438210134a41e9c8cb1f14cb3f13cc22c700b39458cf16019132e27002c912f0378040fb000201580c0d0029fe4400c00e582a801e78b00fd0100b8ac65b56664c0201480e0f002b5c8801801cb055003cf1601fa027001cb6a01cf17c9800615f8276f223021bc8e2372fb02708010c8cb0558cf1621fa02cb6a8210d53276db5802cb1fcb3fc9810082fb00925f03e28020162111200c9f90408085fa4137d28948472aa99880c08085fa0537d0cc7d007d002cb60938ca18382980711801690000d5005200fd00015400e90000d5005200fd000154091909502cd011081aace42cacfd0100fd0101408085fa20a90980c08085fa3a37d289742f81c0099d90408085fa4137d28948471efd001809b812012e80c08085fa0537d0cc7d007d002cb60938ca18382980711801d02cd0642cacfd0100fd0101408085fa20a90980c08085fa3a37d289742f81c020148141c0201581518020166161700313b51343e90007e187e90007e18bd01007e18fd01007e19346000293e113e10f23e1073c5be10b3c5bd003d00327b55200191ff6d176fd916ba66829a1f6a276a2f6a3c71218e46587e480c10815f0969be4658f89e59fe600e78b7c20b8016489781bc0207d806d98f6b3f6b2f6b2393ff688c576a0f6f880f97fc1902fefa40d2000101fa00fa40fa40fa00f40455605f0433f84c22db3cf2e3e9f8235006a1810258b9f2e3fa5004018e125210206f1620c000915b96016f1459a984e28e135210206f1420c000915b96016f1659a984e201e230f843230181010bf40a6fa198fa00fa00596c12719430705300e231f2e3ee21bef2e3ee6d21a34140301a02fe53210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23002a001c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf441f843f844f048f84c40132370db3cf8465004bef2e3fdf84758bef2e3fc01bef2e3eff84301f047f863f093281b0142db3c0182102be12d37c8cb1f13cb3fcc01cf16f8417002c912f0378040fb00db31250201ce1d260201201e2201913b68bb7ec8b5d33414d0fb513b517b51e3890c7232c3f24060840af84b4df232c7c4f2cff30073c5be105c00b244bc0de0103ec036cc7b59fb597b591c9ffb4462bb507b7c407cbfe01f02b4fa40d2000101fa00fa40fa40fa00f40455605f0433f84c22db3cf2e3e9f8235006a1810258b9f2e3fa5004018e125210206f1720c000915b96016f1559a984e28e135210206f1520c000915b96016f1759a984e201e2306d5331302002f453210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23058a0c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf441f843f844f048f84c03414470db3cf8465004bef2e3fdf84758bef2e3fc01bef2e3eff8445410222821018c53210181010bf40a6fa194fa00307193307020e23001a0c801fa020281010bf441f864f093db3c0182102be12d37c8cb1f13cb3fcc01cf16f8417002c912f0378040fb00db312502d73b68bb7ec84835d275c67e9034c7c04074c9c050cc00fe903e903e8015480cc411440d161b10be1308b6cf14d97b513b517b51e3890c7232c3f24060840af84b4df232c7c4f2cff30073c5be105c00b244bc0de0103ec036cc7b59fb597b591c9ffb4462bb507b7c407cbfe030230186f2e3e9f8235004a1810258b9f2e3fa58206f1520c000915b96016f1759a984e2f843220181010bf40a6fa198fa00fa00596c12719430705300e23031b6086d21a341302401fa53210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23058a0c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf441f84301f047f863f093db3c0182102be12d37c8cb1f13cb3fcc01cf16f8417002c912f0378040fb00db3125001070c8cb0f01fa02c904f74eda2edfb2220d749d719fa40d31f0101d32701433003fa40fa40fa0055203310451034586c4224d74cd0fa4031fa0031f40431fa4030f84c23db3cf84c23db3c53a9ed44ed45ed478e2431c8cb0fc90182102be12d37c8cb1f13cb3fcc01cf16f8417002c912f0378040fb00db31ed67ed65ed64727fed118aed4183030273502fef8235009a1810258b9f2e3fa01f2e3e906f2e3e9f84cf8436d52707fdb3cf848c2008e13f8495003b9f8485004b913b15222b9b1f2e3f29d33f84958b95213b912b1f2e3f2e25232206f1520c000915b96016f1759a984e253540181010bf40a6fa13051630181010bf40a6fa13006fa003006fa0030541466a984266f1c21283102f65413346d2181010bf4826fa512908ee3fa00fa00fa00fa00d2000101d30d0101d30d016f00706f8c706f8c706f8c706f8c50086f8c50066f8c50046f8c586f8c706f8c706f8c706f8c586f8c50036f8c586f8c706f8c3153510181010bf40a6fa198fa00fa00596c12719430705300e2305363e810255f05542003292b01f40181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e2955033a002a0915be221c20021c200b18e365112206f1620c000915b96016f1459a984e202206f1720c000915b96016f1559a984e222103459c85959fa0201fa020281010bf44101925f03e252202a00120181010bf4746fa51202906d93236eb38e8d2381010bf4826fa512908ae85be86c317054700181010bf4826fa512908ae85b6c3321c0009530705202138e135321a12381271022a984128127105003a9845ae22c2f02f6fa00fa00593253520181010bf40a6fa15363b1c3009420f2e3f0de8f46543431245d0181010bf40a6fa198fa00fa00596c12719430705300e23003a059a0c85959fa0201fa020281010bf44104fa00d307593120c0018e88c002925f03e30d04e30d04925f03e251440181010bf4593052050181010bf4746fa5122d2e00fcfa40fa40fa00fa00fa00554035547514a984527326a984103c44405d0181010bf40a6fa198fa00fa00596c12719430705300e23003a059a0c85959fa0201fa020281010bf441543312a9844414a9841347705d0181010bf40a6fa198fa00fa00596c12719430705300e23003a059a0c85959fa0201fa020281010bf44104008230fa40fa00fa00552033543332a9844434a9841037125d0181010bf40a6fa198fa00fa00596c12719430705300e23003a059a0c85959fa0201fa020281010bf44101d45371db3c3053720181010bf40a6fa130fa00d307593203fa00fa00593224821005f5e100a98404821005f5e100a98401c0009d216f1d945162a006de5155a005de216f1d9e12a1b60b016f1b812710a98412a09a326f1b812710a98412a0e252420181010bf4746fa5123000ae0181010bf40a6fa1b394306f0070e0fa00fa00fa00fa00d2000101d30d0101d30d016f00706f8c706f8c706f8c706f8c50086f8c50066f8c50046f8c586f8c706f8c706f8c706f8c586f8c50036f8c586f8c706f8c317101fc812710a984a05207206f1420c000915b96016f1659a984e2f843250181010bf40a6fa198fa00fa00596c12719430705300e23031f843240181010bf40a6fa198fa00fa00596c12719430705300e25b5115bef2e3ee21bef2e3ee5065821005f5e100a9848127105806a984f84a21bbf2e3fef84b01bef2e3fe6d21a341303201ae53210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23058a0c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf44122a341403301fc53210181010bf40a6fa1b394307053008e1bd20001aa00a401fa0002a801d20001aa00a401fa0002a8126c1271e23002a001c8595920c1001201ca0001b60bfa020120c1001201ca0001b60bfa020281010bf441f84301f047f863f093db3c0182102be12d37c8cb1f13cb3fcc01cf16f8417002c912f0378040fb00db3134001670c8cb0f58fa0201fa02c9000aedf101f2ff0019a0a273e125f083f085f087f089006cfeb4" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "hash": "1848df7451c2db0eb21df991fd59707c6334871cf9a41409b18dbc541682ceb0", "hashBase64": "GEjfdFHC2w6yHfmR/VlwfGM0hxz5pBQJsY28VBaCzrA=", "hex": "b5ee9c724102110100027e000114ff00f4a413f4bcf2c80b0102016202100202c9030b0201200408029fd4831c02497c1383c0cbb51341bc03e18be903e903e803e1094011be33e18be10961be33e18be10805be33e18b4485bc52456f8085bc5a0824e8f29aeb8c0885bc5a0842b9fc9deaeb8c096e103fcbc2050701fc216f15f8426f10c705f2e3e8f8426f10f04702fa40fa40fa00f40430266f13aa0022a082100bebc200a08208989680a0276f1121b9f2d3eaf8426f1217a120c101f2d3eec882093a3ca6f8416f1702cb1fcb3ff8426f10cf1651511057473401f0488208989680046f1214b60972fb02f8426f1103c94330f03c8306fb00060044f84201216f1201a0726f85f862f842c8216f10cf16216f11cf16016f12fa02c9ed540086216f15f8426f11c705f2e3e8fa40fa0030f84201216f1201a1726f85f862f842c8216f10cf16216f11cf16016f12fa02c9ed54216f178208989680036f1213b609f04b020158090a00a5b4bb4205a1a607f481f48063f40063e803f40063f40002e1f0746204e3618002412c070041ae4207bc07a63e0203a67e0224de00a012df18a00edf18a00adf18b0df18b0df1802df18b0df18b0df1841f0c2030029b991003003960aa0079e2c03f40402e2b196d599930201620c0d004bf80ea00eb9c80e983817971f5e001f971f66a69ff980180c08085fa0537d0f971f6fd00180940201480e0f002d4c85003cf1601fa02f400c95034cbff01fa0201cf16cc800615f8276f223021bc8e2372fb02708010c8cb0558cf1621fa02cb6a82107d7aec1d5802cb1fcb3fc9810082fb00925f03e280065a0a8d5da89a0de01f0c5f481f481f401f084a008df19f0c5f084b0df19f0c5f08402df19f0c5a3f084de21f084de23f084de25313d8fa8" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "hash": "5984ead868e5af89236aea0594d4f6015ed93330de80792d94bf6abe2eb58656", "hashBase64": "WYTq2Gjlr4kjauoFlNT2AV7ZMzDegHktlL9qvi61hlY=", "hex": "b5ee9c7241021301000325000114ff00f4a413f4bcf2c80b0102016202120202cb030f0201200407020148050600d743322c700925f03e0d0d3030171b0925f03e0fa40fa4031fa003171d721fa0031fa003073a9b40003d31f012082100f8a7ea5ba95305023f00de0208210178d4519ba95304133f00fe020821005db0ab7ba95304133f010e08210595f07bcba945023f011e05f04840ff2f0800114fa4430c000f2e14d8020158080a01f7503d33f0101fa00fa4021f00282017b02ed43d8522ac705f2e2c144087054201354140333c858cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d002fa40f40431fa0020d749c200f2e2c42191729171e25372a00ca81ba082098cba80a05008b6095144bcf2e2c577c8801801cb0580900665004cf165004fa0212cb6bccc88210178d451901cb1f500401cb3f58fa025004cf165003cf1601fa0258cf16c901ccc971fb000201200b0e01b33e903e802082319750096806284865948668062841e44e3889f0803cb8b148254c040d5b1078c34835c2c070c008f0802c23889c3220040072c15633c59400fe8084b2daa084354c9db6c072c7c04072cff25cbec02497c0f8a00c01b86d27d2000193d430d0de7f21d749c0178e3901d70b1682087fff61ba8e2c5b70c8821090d0a42f01cb1f2601cb3f5352a0fa0224cf16c971c8801001cb0529cf165374a0fa02cb6acc01de9131e2951027365f04e30d01c971fb00010d005e30c882107362d09c01cb1f2501cb3f5004fa0258cf165005cf16c971c8801001cb055005cf1658fa0213cb6a12cc01009b20805ec0bb50f60cc1b4cfc0407e803e901510699c150804d50500ccf21633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff2741401f1c17cb8b0c41180d155413c03a00201ce1011003520805ec0bb50f60408d7c0c134cfc0407e800411840d504c3c03a000af0c60805ec0bb50f616c134cfc0407e803e900c1499b1c17cb8b0608231975014012808e804a870803cb8b17220842434290bc072c7c04072cfc87e809400f3c5b25c7220040072c15400f3c59400fe80b2dab3325c7ec0200023a0f605da89a1f481f481a861f04ede20aa41382cdc56" }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Contract, OpenedContract } from "@ton/ton";
|
|
2
|
+
import { AddressInput } from "../contracts/common/type";
|
|
3
|
+
export declare class ContractCache {
|
|
4
|
+
private static instance;
|
|
5
|
+
private cache;
|
|
6
|
+
private constructor();
|
|
7
|
+
static getInstance(): ContractCache;
|
|
8
|
+
static createCacheKey<T extends Contract>(address: AddressInput, contractName?: string): string;
|
|
9
|
+
hasKey(key: string): boolean;
|
|
10
|
+
has<T extends Contract>(contract: T): boolean;
|
|
11
|
+
get<T extends Contract>(contract: T): OpenedContract<T>;
|
|
12
|
+
set<T extends Contract>(contract: T, openedContract: OpenedContract<T>): void;
|
|
13
|
+
delete<T extends Contract>(contract: T): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function withCache<T extends object>(instance: T, ttl?: number): T;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContractCache = void 0;
|
|
4
|
+
exports.withCache = withCache;
|
|
5
|
+
const ton_1 = require("@ton/ton");
|
|
6
|
+
const utils_1 = require("../contracts/common/utils");
|
|
7
|
+
class ContractCache {
|
|
8
|
+
static instance;
|
|
9
|
+
cache = new Map();
|
|
10
|
+
constructor() { }
|
|
11
|
+
static getInstance() {
|
|
12
|
+
if (!ContractCache.instance) {
|
|
13
|
+
ContractCache.instance = new ContractCache();
|
|
14
|
+
}
|
|
15
|
+
return ContractCache.instance;
|
|
16
|
+
}
|
|
17
|
+
static createCacheKey(address, contractName) {
|
|
18
|
+
return `${contractName ?? "Anonymous"}_${(0, utils_1.toAddress)(address).toString()}`;
|
|
19
|
+
}
|
|
20
|
+
hasKey(key) {
|
|
21
|
+
return this.cache.has(key);
|
|
22
|
+
}
|
|
23
|
+
has(contract) {
|
|
24
|
+
const key = ContractCache.createCacheKey(contract.address, contract.constructor.name);
|
|
25
|
+
return this.cache.has(key);
|
|
26
|
+
}
|
|
27
|
+
get(contract) {
|
|
28
|
+
const key = ContractCache.createCacheKey(contract.address, contract.constructor.name);
|
|
29
|
+
return this.cache.get(key);
|
|
30
|
+
}
|
|
31
|
+
set(contract, openedContract) {
|
|
32
|
+
const key = ContractCache.createCacheKey(contract.address, contract.constructor.name);
|
|
33
|
+
this.cache.set(key, openedContract);
|
|
34
|
+
}
|
|
35
|
+
delete(contract) {
|
|
36
|
+
const key = ContractCache.createCacheKey(contract.address, contract.constructor.name);
|
|
37
|
+
this.cache.delete(key);
|
|
38
|
+
}
|
|
39
|
+
clear() {
|
|
40
|
+
this.cache.clear();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ContractCache = ContractCache;
|
|
44
|
+
function withCache(instance, ttl = 2500) {
|
|
45
|
+
const cache = new Map();
|
|
46
|
+
const inflightRequests = new Map();
|
|
47
|
+
return new Proxy(instance, {
|
|
48
|
+
get(target, prop) {
|
|
49
|
+
const value = target[prop];
|
|
50
|
+
// Return as-is if not a function
|
|
51
|
+
if (typeof value !== "function") {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
const methodName = String(prop);
|
|
55
|
+
// Only cache methods that start with 'get'
|
|
56
|
+
if (!methodName.startsWith("get")) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
// Return cached function
|
|
60
|
+
return async function (...args) {
|
|
61
|
+
// Generate cache key (method name + arguments)
|
|
62
|
+
const params = JSON.stringify(args, (key, value) => typeof value === "bigint" ||
|
|
63
|
+
value instanceof ton_1.Cell ||
|
|
64
|
+
value instanceof ton_1.Address
|
|
65
|
+
? value.toString()
|
|
66
|
+
: value);
|
|
67
|
+
const key = `${methodName}_${params}`;
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
// 1. Check cache
|
|
70
|
+
const cached = cache.get(key);
|
|
71
|
+
if (cached && now < cached.expiry) {
|
|
72
|
+
return cached.data;
|
|
73
|
+
}
|
|
74
|
+
// 2. Check if there's already an inflight request
|
|
75
|
+
const inflight = inflightRequests.get(key);
|
|
76
|
+
if (inflight) {
|
|
77
|
+
return await inflight;
|
|
78
|
+
}
|
|
79
|
+
// 3. Start new request
|
|
80
|
+
const promise = Promise.resolve(value.apply(target, args))
|
|
81
|
+
.then((data) => {
|
|
82
|
+
// Store in cache on success
|
|
83
|
+
cache.set(key, { data, expiry: now + ttl });
|
|
84
|
+
return data;
|
|
85
|
+
})
|
|
86
|
+
.finally(() => {
|
|
87
|
+
// Remove from inflight requests after completion
|
|
88
|
+
inflightRequests.delete(key);
|
|
89
|
+
});
|
|
90
|
+
// Register as inflight request
|
|
91
|
+
inflightRequests.set(key, promise);
|
|
92
|
+
return await promise;
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Contract, OpenedContract, TonClient } from "@ton/ton";
|
|
2
|
+
import { ContractCache } from "./cache";
|
|
3
|
+
import { Address, Sender } from "@ton/core";
|
|
4
|
+
import { AddressInput } from "../contracts/common/type";
|
|
5
|
+
export declare class ServiceBaseV1 {
|
|
6
|
+
readonly client: TonClient;
|
|
7
|
+
readonly network: "testnet" | "mainnet" | "custom";
|
|
8
|
+
contracts: Record<string, string>;
|
|
9
|
+
readonly contractCache: ContractCache;
|
|
10
|
+
readonly cache_ttl: number;
|
|
11
|
+
constructor(client: TonClient, network: "testnet" | "mainnet" | "custom", custom_contracts?: Record<string, string>, cache_ttl?: number);
|
|
12
|
+
getByContract<T extends Contract>(contractType: {
|
|
13
|
+
createFromAddress(address: Address): T;
|
|
14
|
+
name?: string;
|
|
15
|
+
}, address_: AddressInput): OpenedContract<T>;
|
|
16
|
+
protected open<T extends Contract>(contract: T): OpenedContract<T>;
|
|
17
|
+
getWalletSeq(address: Address): Promise<number>;
|
|
18
|
+
waitWalletSeq(address: Address, nextSeqno: number, sleepInterval?: number): Promise<number>;
|
|
19
|
+
deployWTONWallet(sender: Sender, owner: AddressInput): Promise<number>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceBaseV1 = void 0;
|
|
4
|
+
const contracts_1 = require("../constants/contracts");
|
|
5
|
+
const cache_1 = require("./cache");
|
|
6
|
+
const core_1 = require("@ton/core");
|
|
7
|
+
const utils_1 = require("../contracts/common/utils");
|
|
8
|
+
const jetton_minter_1 = require("../contracts/wton/jetton-minter");
|
|
9
|
+
class ServiceBaseV1 {
|
|
10
|
+
client;
|
|
11
|
+
network;
|
|
12
|
+
contracts;
|
|
13
|
+
contractCache;
|
|
14
|
+
cache_ttl = 2500;
|
|
15
|
+
constructor(client, network, custom_contracts, cache_ttl) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
this.network = network;
|
|
18
|
+
if (network === "custom" && !custom_contracts)
|
|
19
|
+
throw "should provide custom contracts";
|
|
20
|
+
this.contracts =
|
|
21
|
+
network === "mainnet"
|
|
22
|
+
? contracts_1.MAINNET_CONTRACTS
|
|
23
|
+
: network === "testnet"
|
|
24
|
+
? contracts_1.TESTNET_CONTRACTS
|
|
25
|
+
: custom_contracts;
|
|
26
|
+
this.contractCache = cache_1.ContractCache.getInstance();
|
|
27
|
+
this.cache_ttl = cache_ttl || this.cache_ttl;
|
|
28
|
+
}
|
|
29
|
+
getByContract(contractType, address_) {
|
|
30
|
+
const address = (0, utils_1.toAddress)(address_);
|
|
31
|
+
const contract = this.open(contractType.createFromAddress(address));
|
|
32
|
+
return contract;
|
|
33
|
+
}
|
|
34
|
+
open(contract) {
|
|
35
|
+
if (this.contractCache.has(contract)) {
|
|
36
|
+
return this.contractCache.get(contract);
|
|
37
|
+
}
|
|
38
|
+
const openedContract = (0, cache_1.withCache)(this.client.open(contract), this.cache_ttl);
|
|
39
|
+
this.contractCache.set(contract, openedContract);
|
|
40
|
+
return openedContract;
|
|
41
|
+
}
|
|
42
|
+
async getWalletSeq(address) {
|
|
43
|
+
const seqnoRaw = await this.client.runMethod(address, "seqno");
|
|
44
|
+
return seqnoRaw.stack.readNumber();
|
|
45
|
+
}
|
|
46
|
+
async waitWalletSeq(address, nextSeqno, sleepInterval = 2000) {
|
|
47
|
+
while (true) {
|
|
48
|
+
const currentSeqno = await this.getWalletSeq(address);
|
|
49
|
+
if (currentSeqno >= nextSeqno) {
|
|
50
|
+
return currentSeqno;
|
|
51
|
+
}
|
|
52
|
+
await new Promise((resolve) => setTimeout(resolve, sleepInterval)); // 2초 대기
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async deployWTONWallet(sender, owner) {
|
|
56
|
+
owner = (0, utils_1.toAddress)(owner);
|
|
57
|
+
const lastSeqno = await this.getWalletSeq(sender.address);
|
|
58
|
+
const wtonMinter = this.getByContract(jetton_minter_1.WTONMinter, this.contracts.WTON);
|
|
59
|
+
const wtonWalletAddress = await wtonMinter.getWalletAddress(owner);
|
|
60
|
+
const state = await this.client.getContractState(wtonWalletAddress);
|
|
61
|
+
if (state.state === "active")
|
|
62
|
+
return lastSeqno;
|
|
63
|
+
await wtonMinter.sendMint(sender, (0, core_1.toNano)(0.008), {
|
|
64
|
+
recipient: owner,
|
|
65
|
+
});
|
|
66
|
+
return this.waitWalletSeq(sender.address, lastSeqno + 1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ServiceBaseV1 = ServiceBaseV1;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShareVault } from "../contracts/vault/share-vault";
|
|
2
|
+
import { StrategyVault } from "../contracts/vault/strategy-vault";
|
|
3
|
+
export type UnderlyingAssetType = {
|
|
4
|
+
type: "underlying-asset";
|
|
5
|
+
};
|
|
6
|
+
export type ShareVaultType = {
|
|
7
|
+
type: "share-vault";
|
|
8
|
+
data: Awaited<ReturnType<typeof ShareVault.parseVaultData>>;
|
|
9
|
+
};
|
|
10
|
+
export type StrategyVaultType = {
|
|
11
|
+
type: "strategy-vault";
|
|
12
|
+
data: Awaited<ReturnType<typeof StrategyVault.parseVaultData>>;
|
|
13
|
+
};
|
|
14
|
+
export type AssetType = UnderlyingAssetType | ShareVaultType | StrategyVaultType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Address, Cell, Contract, ContractProvider } from "@ton/core";
|
|
2
|
+
export declare class UnknownContract implements Contract {
|
|
3
|
+
readonly address: Address;
|
|
4
|
+
readonly init?: {
|
|
5
|
+
code: Cell;
|
|
6
|
+
data: Cell;
|
|
7
|
+
} | undefined;
|
|
8
|
+
constructor(address: Address, init?: {
|
|
9
|
+
code: Cell;
|
|
10
|
+
data: Cell;
|
|
11
|
+
} | undefined);
|
|
12
|
+
static createFromAddress(address: Address): UnknownContract;
|
|
13
|
+
getState(provider: ContractProvider): Promise<import("@ton/core").ContractState>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownContract = void 0;
|
|
4
|
+
class UnknownContract {
|
|
5
|
+
address;
|
|
6
|
+
init;
|
|
7
|
+
constructor(address, init) {
|
|
8
|
+
this.address = address;
|
|
9
|
+
this.init = init;
|
|
10
|
+
}
|
|
11
|
+
static createFromAddress(address) {
|
|
12
|
+
return new UnknownContract(address);
|
|
13
|
+
}
|
|
14
|
+
async getState(provider) {
|
|
15
|
+
return await provider.getState();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.UnknownContract = UnknownContract;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Cell } from "@ton/core";
|
|
2
|
+
export type CodeHash = ReturnType<Cell["hash"]>;
|
|
3
|
+
export type CodeHashHex = string;
|
|
4
|
+
export declare const AffluentVersions: {
|
|
5
|
+
readonly ShareV1: "share-v1";
|
|
6
|
+
readonly ShareV2: "share-v2";
|
|
7
|
+
readonly StrategyV1: "strategy-v1";
|
|
8
|
+
readonly StrategyV2: "strategy-v2";
|
|
9
|
+
};
|
|
10
|
+
export type AffluentVersion = (typeof AffluentVersions)[keyof typeof AffluentVersions];
|
|
11
|
+
export declare class ContractVersions {
|
|
12
|
+
static readonly versionOfCodeHash: Map<string, AffluentVersion>;
|
|
13
|
+
getVersion(codeCell: Cell): AffluentVersion | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContractVersions = exports.AffluentVersions = void 0;
|
|
4
|
+
exports.AffluentVersions = {
|
|
5
|
+
ShareV1: "share-v1",
|
|
6
|
+
ShareV2: "share-v2",
|
|
7
|
+
StrategyV1: "strategy-v1",
|
|
8
|
+
StrategyV2: "strategy-v2",
|
|
9
|
+
};
|
|
10
|
+
class ContractVersions {
|
|
11
|
+
static versionOfCodeHash = new Map();
|
|
12
|
+
getVersion(codeCell) {
|
|
13
|
+
return ContractVersions.versionOfCodeHash.get(codeCell.hash().toString("hex"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ContractVersions = ContractVersions;
|
|
17
|
+
ContractVersions.versionOfCodeHash.set("eb9d9891a32ec94425c09735f6ade73f4c171da0091f874d6e9d25247d583990", // USDT/TON-LV
|
|
18
|
+
exports.AffluentVersions.ShareV1);
|
|
19
|
+
ContractVersions.versionOfCodeHash.set("bca42dbdcbc0d885aaffb1eeeb027d9f338c2dd68701a05641c1d1c3171a7400", // TON-MV
|
|
20
|
+
exports.AffluentVersions.StrategyV1);
|
|
21
|
+
ContractVersions.versionOfCodeHash.set("f66c149de251ffd031bdb34b79abe43a062ba16b815433691e3ec40a77f01d71", // ELSE
|
|
22
|
+
exports.AffluentVersions.StrategyV1);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const PERCENT_BIT = 14;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Address, Cell, Contract, ContractProvider, Sender } from "@ton/core";
|
|
2
|
+
export type SimpleOracleConfig = {
|
|
3
|
+
owner: Address;
|
|
4
|
+
};
|
|
5
|
+
export declare function simpleOracleConfigToCell(config: SimpleOracleConfig): Cell;
|
|
6
|
+
export declare const Opcodes: {
|
|
7
|
+
setPrice: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class SimpleOracle implements Contract {
|
|
10
|
+
readonly address: Address;
|
|
11
|
+
readonly init?: {
|
|
12
|
+
code: Cell;
|
|
13
|
+
data: Cell;
|
|
14
|
+
} | undefined;
|
|
15
|
+
constructor(address: Address, init?: {
|
|
16
|
+
code: Cell;
|
|
17
|
+
data: Cell;
|
|
18
|
+
} | undefined);
|
|
19
|
+
static createFromAddress(address: Address): SimpleOracle;
|
|
20
|
+
static createFromConfig(config: SimpleOracleConfig, code: Cell, workchain?: number): SimpleOracle;
|
|
21
|
+
sendDeploy(provider: ContractProvider, via: Sender, value: bigint): Promise<void>;
|
|
22
|
+
sendSetPrice(provider: ContractProvider, via: Sender, opts: {
|
|
23
|
+
value: bigint;
|
|
24
|
+
assetId: bigint;
|
|
25
|
+
price: bigint;
|
|
26
|
+
queryID?: number;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
getState(provider: ContractProvider): Promise<import("@ton/core").ContractState>;
|
|
29
|
+
getOwnerForTest(provider: ContractProvider): Promise<Cell>;
|
|
30
|
+
getOracleData(provider: ContractProvider): Promise<{
|
|
31
|
+
owner: Address;
|
|
32
|
+
prices: Record<string, bigint>;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimpleOracle = exports.Opcodes = void 0;
|
|
4
|
+
exports.simpleOracleConfigToCell = simpleOracleConfigToCell;
|
|
5
|
+
const core_1 = require("@ton/core");
|
|
6
|
+
function simpleOracleConfigToCell(config) {
|
|
7
|
+
return (0, core_1.beginCell)()
|
|
8
|
+
.storeAddress(config.owner)
|
|
9
|
+
.storeDict(core_1.Dictionary.empty())
|
|
10
|
+
.endCell();
|
|
11
|
+
}
|
|
12
|
+
exports.Opcodes = {
|
|
13
|
+
setPrice: 0xf990365,
|
|
14
|
+
};
|
|
15
|
+
class SimpleOracle {
|
|
16
|
+
address;
|
|
17
|
+
init;
|
|
18
|
+
constructor(address, init) {
|
|
19
|
+
this.address = address;
|
|
20
|
+
this.init = init;
|
|
21
|
+
}
|
|
22
|
+
static createFromAddress(address) {
|
|
23
|
+
return new SimpleOracle(address);
|
|
24
|
+
}
|
|
25
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
26
|
+
const data = simpleOracleConfigToCell(config);
|
|
27
|
+
const init = { code, data };
|
|
28
|
+
return new SimpleOracle((0, core_1.contractAddress)(workchain, init), init);
|
|
29
|
+
}
|
|
30
|
+
async sendDeploy(provider, via, value) {
|
|
31
|
+
await provider.internal(via, {
|
|
32
|
+
value,
|
|
33
|
+
sendMode: core_1.SendMode.PAY_GAS_SEPARATELY,
|
|
34
|
+
body: (0, core_1.beginCell)().endCell(),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async sendSetPrice(provider, via, opts) {
|
|
38
|
+
await provider.internal(via, {
|
|
39
|
+
value: opts.value,
|
|
40
|
+
sendMode: core_1.SendMode.PAY_GAS_SEPARATELY,
|
|
41
|
+
body: (0, core_1.beginCell)()
|
|
42
|
+
.storeUint(exports.Opcodes.setPrice, 32)
|
|
43
|
+
.storeUint(opts.queryID ?? 0, 64)
|
|
44
|
+
.storeUint(opts.assetId, 64)
|
|
45
|
+
.storeCoins(opts.price)
|
|
46
|
+
.endCell(),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async getState(provider) {
|
|
50
|
+
return await provider.getState();
|
|
51
|
+
}
|
|
52
|
+
async getOwnerForTest(provider) {
|
|
53
|
+
const result = await provider.get("get_owner", []);
|
|
54
|
+
return result.stack.readCell();
|
|
55
|
+
}
|
|
56
|
+
async getOracleData(provider) {
|
|
57
|
+
const result = await provider.get("get_oracle_data", []);
|
|
58
|
+
const owner = result.stack.readAddress();
|
|
59
|
+
const _prices = result.stack.readTuple();
|
|
60
|
+
const prices = {};
|
|
61
|
+
if (_prices) {
|
|
62
|
+
while (_prices.remaining) {
|
|
63
|
+
const priceData = _prices.pop();
|
|
64
|
+
prices[priceData[0].toString()] = priceData[1];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
owner,
|
|
69
|
+
prices,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.SimpleOracle = SimpleOracle;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Address } from "@ton/core";
|
|
2
|
+
import { Maybe } from "../../../contracts/common/type";
|
|
3
|
+
export type ShareVaultState = {
|
|
4
|
+
address: Address;
|
|
5
|
+
totalSupply: bigint;
|
|
6
|
+
owner: Maybe<Address>;
|
|
7
|
+
manager: Maybe<Address>;
|
|
8
|
+
asset: Address;
|
|
9
|
+
balance: bigint;
|
|
10
|
+
cash: bigint;
|
|
11
|
+
totalTargetWeight: bigint;
|
|
12
|
+
nextAggregatorIndex: bigint;
|
|
13
|
+
isWtonVault: boolean;
|
|
14
|
+
assetWallet: Maybe<Address>;
|
|
15
|
+
whitelistedPools: Record<string, WhitelistedPool>;
|
|
16
|
+
minimumGasFee: ShareVaultGasFee;
|
|
17
|
+
};
|
|
18
|
+
export type ShareVaultGasFee = {
|
|
19
|
+
supply: bigint;
|
|
20
|
+
withdraw: bigint;
|
|
21
|
+
factorialSupply: bigint;
|
|
22
|
+
factorialWithdraw: bigint;
|
|
23
|
+
mintVaultShareTokens: bigint;
|
|
24
|
+
};
|
|
25
|
+
export type WhitelistedPool = {
|
|
26
|
+
address: Address;
|
|
27
|
+
isWhitelisted: boolean;
|
|
28
|
+
targetWeight: bigint;
|
|
29
|
+
supply: bigint;
|
|
30
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Cell } from "@ton/core";
|
|
2
|
+
export declare function tempParseRFQConfig(rfqConfig?: Cell | null): {
|
|
3
|
+
priceDerivationTolerance: number;
|
|
4
|
+
rfqEventEmitterAddress: string | null;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare function tempParseGasConfig(gasConfig?: Cell | null): Record<string, bigint> | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tempParseRFQConfig = tempParseRFQConfig;
|
|
4
|
+
exports.tempParseGasConfig = tempParseGasConfig;
|
|
5
|
+
const core_1 = require("@ton/core");
|
|
6
|
+
function tempParseRFQConfig(rfqConfig) {
|
|
7
|
+
if (!rfqConfig)
|
|
8
|
+
return null;
|
|
9
|
+
const rfqConfigCs = rfqConfig.beginParse();
|
|
10
|
+
const priceDerivationTolerance = rfqConfigCs.loadUint(14);
|
|
11
|
+
const rfqEventEmitterAddress = rfqConfigCs.loadMaybeAddress();
|
|
12
|
+
return {
|
|
13
|
+
priceDerivationTolerance,
|
|
14
|
+
rfqEventEmitterAddress: rfqEventEmitterAddress
|
|
15
|
+
? rfqEventEmitterAddress.toString()
|
|
16
|
+
: null,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function tempParseGasConfig(gasConfig) {
|
|
20
|
+
if (!gasConfig)
|
|
21
|
+
return null;
|
|
22
|
+
const gasConfigCs = gasConfig.beginParse();
|
|
23
|
+
const gasDict = gasConfigCs.loadDictDirect(core_1.Dictionary.Keys.Uint(8), core_1.Dictionary.Values.BigVarUint(4));
|
|
24
|
+
const gasDictObj = {};
|
|
25
|
+
for (const key of gasDict.keys()) {
|
|
26
|
+
const value = gasDict.get(key);
|
|
27
|
+
if (value) {
|
|
28
|
+
gasDictObj[key.toString()] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return gasDictObj;
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PoolServiceV1 as PoolV1 } from "./services/pool";
|
|
2
|
+
import { ShareVaultServiceV1 as ShareVaultV1 } from "./services/share-vault";
|
|
3
|
+
import { StrategyVaultV1 } from "./services/strategy-vault";
|
|
4
|
+
import { RFQAuctionServiceV1 } from "./services/rfq-auction";
|
|
5
|
+
import { RFQBatchServiceV1 } from "./services/rfq-batch";
|
|
6
|
+
export { PoolV1, ShareVaultV1, StrategyVaultV1, RFQAuctionServiceV1 as RFQAuctionV1, RFQBatchServiceV1 as RFQBatchV1 };
|
|
7
|
+
declare const _default: {
|
|
8
|
+
PoolV1: typeof PoolV1;
|
|
9
|
+
ShareVaultV1: typeof ShareVaultV1;
|
|
10
|
+
StrategyVaultV1: typeof StrategyVaultV1;
|
|
11
|
+
RFQAuctionV1: typeof RFQAuctionServiceV1;
|
|
12
|
+
RFQBatchV1: typeof RFQBatchServiceV1;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RFQBatchV1 = exports.RFQAuctionV1 = exports.StrategyVaultV1 = exports.ShareVaultV1 = exports.PoolV1 = void 0;
|
|
4
|
+
const pool_1 = require("./services/pool");
|
|
5
|
+
Object.defineProperty(exports, "PoolV1", { enumerable: true, get: function () { return pool_1.PoolServiceV1; } });
|
|
6
|
+
const share_vault_1 = require("./services/share-vault");
|
|
7
|
+
Object.defineProperty(exports, "ShareVaultV1", { enumerable: true, get: function () { return share_vault_1.ShareVaultServiceV1; } });
|
|
8
|
+
const strategy_vault_1 = require("./services/strategy-vault");
|
|
9
|
+
Object.defineProperty(exports, "StrategyVaultV1", { enumerable: true, get: function () { return strategy_vault_1.StrategyVaultV1; } });
|
|
10
|
+
const rfq_auction_1 = require("./services/rfq-auction");
|
|
11
|
+
Object.defineProperty(exports, "RFQAuctionV1", { enumerable: true, get: function () { return rfq_auction_1.RFQAuctionServiceV1; } });
|
|
12
|
+
const rfq_batch_1 = require("./services/rfq-batch");
|
|
13
|
+
Object.defineProperty(exports, "RFQBatchV1", { enumerable: true, get: function () { return rfq_batch_1.RFQBatchServiceV1; } });
|
|
14
|
+
exports.default = {
|
|
15
|
+
PoolV1: pool_1.PoolServiceV1,
|
|
16
|
+
ShareVaultV1: share_vault_1.ShareVaultServiceV1,
|
|
17
|
+
StrategyVaultV1: strategy_vault_1.StrategyVaultV1,
|
|
18
|
+
RFQAuctionV1: rfq_auction_1.RFQAuctionServiceV1,
|
|
19
|
+
RFQBatchV1: rfq_batch_1.RFQBatchServiceV1,
|
|
20
|
+
};
|
package/dist/farm.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Address, Cell, Sender, TonClient } from "@ton/ton";
|
|
2
|
+
import { TxCallBackFn, TxStep } from "./utils/tracker/type";
|
|
3
|
+
export declare class FarmV1 {
|
|
4
|
+
network: "testnet" | "mainnet" | "custom";
|
|
5
|
+
client: TonClient;
|
|
6
|
+
contracts: Record<string, string>;
|
|
7
|
+
private walletAddresses;
|
|
8
|
+
private accountAddresses;
|
|
9
|
+
constructor(client: TonClient, network: "testnet" | "mainnet" | "custom", custom_contracts?: Record<string, string>);
|
|
10
|
+
getAccountAddress(owner: string, pool: string): Promise<Address>;
|
|
11
|
+
findAndCallback(target: Address, step: TxStep, createdLt: string | bigint, callbackFn?: TxCallBackFn): Promise<import("./utils/tracker/type").MatchedTxResult>;
|
|
12
|
+
claimFactorialRewardAndWaitTx(sender: Sender, params: {
|
|
13
|
+
senderAddress: Address | string;
|
|
14
|
+
rewardAssetAddress: Address | string;
|
|
15
|
+
distributorAddress: Address | string;
|
|
16
|
+
responseAddress: Address | string;
|
|
17
|
+
receipientAddress: Address | string;
|
|
18
|
+
proofCell: Cell;
|
|
19
|
+
gas?: bigint;
|
|
20
|
+
}, callbackFn?: TxCallBackFn): Promise<{
|
|
21
|
+
action: {
|
|
22
|
+
type: string;
|
|
23
|
+
params: {
|
|
24
|
+
senderAddress: Address | string;
|
|
25
|
+
rewardAssetAddress: Address | string;
|
|
26
|
+
distributorAddress: Address | string;
|
|
27
|
+
responseAddress: Address | string;
|
|
28
|
+
receipientAddress: Address | string;
|
|
29
|
+
proofCell: Cell;
|
|
30
|
+
gas?: bigint;
|
|
31
|
+
};
|
|
32
|
+
queryId: bigint;
|
|
33
|
+
};
|
|
34
|
+
steps: TxStep[];
|
|
35
|
+
}>;
|
|
36
|
+
findTx(action: any, callbackFn?: TxCallBackFn): Promise<{
|
|
37
|
+
action: {
|
|
38
|
+
type: string;
|
|
39
|
+
params: {
|
|
40
|
+
senderAddress: Address | string;
|
|
41
|
+
rewardAssetAddress: Address | string;
|
|
42
|
+
distributorAddress: Address | string;
|
|
43
|
+
responseAddress: Address | string;
|
|
44
|
+
receipientAddress: Address | string;
|
|
45
|
+
proofCell: Cell;
|
|
46
|
+
gas?: bigint;
|
|
47
|
+
};
|
|
48
|
+
queryId: bigint;
|
|
49
|
+
};
|
|
50
|
+
steps: TxStep[];
|
|
51
|
+
} | undefined>;
|
|
52
|
+
findFactorialClaimTx(queryId: bigint, params: {
|
|
53
|
+
senderAddress: Address | string;
|
|
54
|
+
rewardAssetAddress: Address | string;
|
|
55
|
+
distributorAddress: Address | string;
|
|
56
|
+
responseAddress: Address | string;
|
|
57
|
+
receipientAddress: Address | string;
|
|
58
|
+
proofCell: Cell;
|
|
59
|
+
gas?: bigint;
|
|
60
|
+
}, callbackFn?: TxCallBackFn): Promise<{
|
|
61
|
+
action: {
|
|
62
|
+
type: string;
|
|
63
|
+
params: {
|
|
64
|
+
senderAddress: Address | string;
|
|
65
|
+
rewardAssetAddress: Address | string;
|
|
66
|
+
distributorAddress: Address | string;
|
|
67
|
+
responseAddress: Address | string;
|
|
68
|
+
receipientAddress: Address | string;
|
|
69
|
+
proofCell: Cell;
|
|
70
|
+
gas?: bigint;
|
|
71
|
+
};
|
|
72
|
+
queryId: bigint;
|
|
73
|
+
};
|
|
74
|
+
steps: TxStep[];
|
|
75
|
+
}>;
|
|
76
|
+
getDistributorData(distributorAddress: Address | string): Promise<{
|
|
77
|
+
owner: Address;
|
|
78
|
+
rewardRootHash: bigint;
|
|
79
|
+
}>;
|
|
80
|
+
getReceiptData(distributorAddress: Address | string, userAddress: Address | string): Promise<{
|
|
81
|
+
deployed: boolean;
|
|
82
|
+
owner: string | Address;
|
|
83
|
+
distributor: string | Address;
|
|
84
|
+
claimed: bigint;
|
|
85
|
+
}>;
|
|
86
|
+
setDistributorRootHash(sender: Sender, params: {
|
|
87
|
+
senderAddress: Address | string;
|
|
88
|
+
distributorAddress: Address | string;
|
|
89
|
+
newRootHash: bigint;
|
|
90
|
+
gas?: bigint;
|
|
91
|
+
}): Promise<void>;
|
|
92
|
+
}
|