@pizzaton/ton 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRACTS.md +239 -0
- package/README.md +481 -2
- package/dist/airdrop/index.d.mts +18 -0
- package/dist/airdrop/index.mjs +86 -0
- package/dist/connect/errors.d.mts +4 -0
- package/dist/connect/errors.mjs +21 -0
- package/dist/connect/index.d.mts +23 -0
- package/dist/connect/index.mjs +34 -0
- package/dist/contracts/catalog/index.d.mts +361 -0
- package/dist/contracts/catalog/index.mjs +403 -0
- package/dist/contracts/client.d.mts +18 -0
- package/dist/contracts/client.mjs +31 -0
- package/dist/contracts/codecs.d.mts +14 -0
- package/dist/contracts/codecs.mjs +61 -0
- package/dist/contracts/hipo.d.mts +138 -0
- package/dist/contracts/hipo.mjs +198 -0
- package/dist/contracts/index.d.mts +23 -0
- package/dist/contracts/index.mjs +20 -0
- package/dist/contracts/metadata.d.mts +38 -0
- package/dist/contracts/metadata.mjs +50 -0
- package/dist/contracts/module-client.d.mts +20 -0
- package/dist/contracts/module-client.mjs +34 -0
- package/dist/contracts/module.d.mts +8 -0
- package/dist/contracts/module.mjs +11 -0
- package/dist/contracts/wrappers/base.d.mts +18 -0
- package/dist/contracts/wrappers/base.mjs +31 -0
- package/dist/contracts/wrappers/index.d.mts +12 -0
- package/dist/contracts/wrappers/index.mjs +12 -0
- package/dist/contracts/wrappers/jvault-protocols.d.mts +206 -0
- package/dist/contracts/wrappers/jvault-protocols.mjs +432 -0
- package/dist/contracts/wrappers/jvault-support.d.mts +135 -0
- package/dist/contracts/wrappers/jvault-support.mjs +269 -0
- package/dist/contracts/wrappers/jvault.d.mts +123 -0
- package/dist/contracts/wrappers/jvault.mjs +258 -0
- package/dist/contracts/wrappers/memeland.d.mts +253 -0
- package/dist/contracts/wrappers/memeland.mjs +396 -0
- package/dist/contracts/wrappers/multix.d.mts +92 -0
- package/dist/contracts/wrappers/multix.mjs +156 -0
- package/dist/contracts/wrappers/pizzabox.d.mts +66 -0
- package/dist/contracts/wrappers/pizzabox.mjs +105 -0
- package/dist/contracts/wrappers/ton-raffles.d.mts +215 -0
- package/dist/contracts/wrappers/ton-raffles.mjs +398 -0
- package/dist/contracts/wrappers/tonresistor.d.mts +189 -0
- package/dist/contracts/wrappers/tonresistor.mjs +276 -0
- package/dist/core/address.d.mts +25 -0
- package/dist/core/address.mjs +45 -0
- package/dist/core/amount.d.mts +8 -0
- package/dist/core/amount.mjs +34 -0
- package/dist/core/bytes.d.mts +5 -0
- package/dist/core/bytes.mjs +18 -0
- package/dist/core/constants.d.mts +14 -0
- package/dist/core/constants.mjs +15 -0
- package/dist/core/errors.d.mts +9 -0
- package/dist/core/errors.mjs +16 -0
- package/dist/core/http.mjs +39 -0
- package/dist/core/index.d.mts +8 -0
- package/dist/core/index.mjs +8 -0
- package/dist/core/metadata.d.mts +12 -0
- package/dist/core/metadata.mjs +35 -0
- package/dist/core/network.d.mts +24 -0
- package/dist/core/network.mjs +41 -0
- package/dist/emulator/index.d.mts +20 -0
- package/dist/emulator/index.mjs +24 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +19 -0
- package/dist/indexer/index.d.mts +90 -0
- package/dist/indexer/index.mjs +279 -0
- package/dist/jetton/details.d.mts +27 -0
- package/dist/jetton/details.mjs +116 -0
- package/dist/jetton/index.d.mts +54 -0
- package/dist/jetton/index.mjs +92 -0
- package/dist/jetton/versions.d.mts +12 -0
- package/dist/jetton/versions.mjs +50 -0
- package/dist/nft/collection.d.mts +57 -0
- package/dist/nft/collection.mjs +148 -0
- package/dist/nft/content.d.mts +34 -0
- package/dist/nft/content.mjs +142 -0
- package/dist/nft/index.d.mts +35 -0
- package/dist/nft/index.mjs +51 -0
- package/dist/nft/versions.d.mts +11 -0
- package/dist/nft/versions.mjs +29 -0
- package/dist/provider/index.d.mts +32 -0
- package/dist/provider/index.mjs +1 -0
- package/dist/react/index.d.mts +13 -0
- package/dist/react/index.mjs +48 -0
- package/dist/server/index.d.mts +11 -0
- package/dist/server/index.mjs +55 -0
- package/dist/simulation/index.d.mts +112 -0
- package/dist/simulation/index.mjs +310 -0
- package/dist/transactions/index.d.mts +33 -0
- package/dist/transactions/index.mjs +51 -0
- package/dist/vesting/index.d.mts +12 -0
- package/dist/vesting/index.mjs +25 -0
- package/dist/wallet/index.d.mts +23 -0
- package/dist/wallet/index.mjs +71 -0
- package/package.json +169 -5
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { uint256CoinsDictionary } from "../codecs.mjs";
|
|
2
|
+
import { ContractWrapper } from "./base.mjs";
|
|
3
|
+
import { Address, Cell, ContractProvider, Dictionary, Sender, Slice } from "@ton/core";
|
|
4
|
+
//#region src/contracts/wrappers/jvault-protocols.d.ts
|
|
5
|
+
/** Exact source revisions for the JVault repositories. */
|
|
6
|
+
export declare const JVAULT_SOURCE_REVISIONS: {
|
|
7
|
+
readonly stakingV2: "f7e83860ba7138c88bf63da13884f54d04589191";
|
|
8
|
+
readonly vesting: "b6d80efdbbeeeda4113ebc9d08c942b543b6b6b6";
|
|
9
|
+
readonly airdrop: "54edd36d242295699278b5668514dd6f2b10260d";
|
|
10
|
+
readonly decentralizedLaunchpad: "83f59e126e5e885f2d7da792998a5d569c0aa944";
|
|
11
|
+
readonly floatingStaking: "51c86b4469fd99b3e2ebdff6f8cdad9fee067b4c";
|
|
12
|
+
readonly fixedStaking: "63cbc8137a7dca0269bcdd9089a9dcc37acbb727";
|
|
13
|
+
};
|
|
14
|
+
export interface JVaultVestingConfig {
|
|
15
|
+
readonly factoryAddress: Address;
|
|
16
|
+
readonly index: bigint;
|
|
17
|
+
readonly ownerAddress?: Address;
|
|
18
|
+
readonly jettonMinterAddress?: Address;
|
|
19
|
+
readonly jettonWalletAddress?: Address | null;
|
|
20
|
+
readonly content?: Cell | null;
|
|
21
|
+
readonly factoryJettonWallet?: Address;
|
|
22
|
+
readonly lockedJettons?: bigint;
|
|
23
|
+
readonly jettonsLocked?: boolean;
|
|
24
|
+
readonly claimedTimes?: number;
|
|
25
|
+
readonly claimedJettons?: bigint;
|
|
26
|
+
readonly firstUnlockTime?: number;
|
|
27
|
+
readonly firstUnlockSize?: number;
|
|
28
|
+
readonly cycleLength?: number;
|
|
29
|
+
readonly cyclesNumber?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function buildJVaultVestingData(config: JVaultVestingConfig): Cell;
|
|
32
|
+
export declare class JVaultVesting extends ContractWrapper {
|
|
33
|
+
static createFromAddress(address: Address): JVaultVesting;
|
|
34
|
+
static createFromConfig(config: JVaultVestingConfig, code: Cell, workchain?: number): JVaultVesting;
|
|
35
|
+
sendClaim(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
36
|
+
sendBurnLockedJettons(provider: ContractProvider, via: Sender, value: bigint, amount?: bigint, queryId?: bigint): Promise<void>;
|
|
37
|
+
sendWithdrawJetton(provider: ContractProvider, via: Sender, value: bigint, wallet: Address, amount: bigint, queryId?: bigint): Promise<void>;
|
|
38
|
+
sendProveOwnership(provider: ContractProvider, via: Sender, value: bigint, destination: Address, payload: Cell, withContent: boolean, queryId?: bigint): Promise<void>;
|
|
39
|
+
sendTakeExcess(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
40
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
41
|
+
getNftData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
42
|
+
}
|
|
43
|
+
export interface JVaultVestingFactoryConfig {
|
|
44
|
+
readonly adminAddress: Address;
|
|
45
|
+
readonly startIndex: bigint;
|
|
46
|
+
readonly creationFee: bigint;
|
|
47
|
+
readonly vestingCodes: Dictionary<bigint, Slice>;
|
|
48
|
+
readonly content?: Cell | null;
|
|
49
|
+
readonly version: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function buildJVaultVestingFactoryData(config: JVaultVestingFactoryConfig): Cell;
|
|
52
|
+
/** Builds the HashmapE(128, Slice) used by the vesting factory code registry. */
|
|
53
|
+
export declare function buildJVaultVestingCodeDictionary(codes: ReadonlyMap<bigint, Cell>): Dictionary<bigint, Slice>;
|
|
54
|
+
export declare class JVaultVestingFactory extends ContractWrapper {
|
|
55
|
+
static createFromAddress(address: Address): JVaultVestingFactory;
|
|
56
|
+
static createFromConfig(config: JVaultVestingFactoryConfig, code: Cell, workchain?: number): JVaultVestingFactory;
|
|
57
|
+
sendDeployVesting(provider: ContractProvider, via: Sender, value: bigint, payload: Cell): Promise<void>;
|
|
58
|
+
sendUpdateVestingCode(provider: ContractProvider, via: Sender, code: Cell, value: bigint): Promise<void>;
|
|
59
|
+
sendChangeCreationFee(provider: ContractProvider, via: Sender, fee: bigint, value: bigint): Promise<void>;
|
|
60
|
+
sendChangeContent(provider: ContractProvider, via: Sender, content: Cell | null, value: bigint): Promise<void>;
|
|
61
|
+
sendWithdrawTon(provider: ContractProvider, via: Sender, value: bigint): Promise<void>;
|
|
62
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
63
|
+
getVestingAddress(provider: ContractProvider, index: bigint): Promise<Address>;
|
|
64
|
+
}
|
|
65
|
+
export type JettonAmountDictionary = Dictionary<bigint, bigint>;
|
|
66
|
+
export interface JVaultAirdropMainConfig {
|
|
67
|
+
readonly publicKey: bigint;
|
|
68
|
+
readonly userContractCode: Cell;
|
|
69
|
+
readonly adminAddress: Address;
|
|
70
|
+
}
|
|
71
|
+
export declare function buildJVaultAirdropMainData(config: JVaultAirdropMainConfig): Cell;
|
|
72
|
+
export declare class JVaultAirdropMain extends ContractWrapper {
|
|
73
|
+
static createFromAddress(address: Address): JVaultAirdropMain;
|
|
74
|
+
static createFromConfig(config: JVaultAirdropMainConfig, code: Cell, workchain?: number): JVaultAirdropMain;
|
|
75
|
+
sendClaim(provider: ContractProvider, via: Sender, owner: Address, campaignId: number, claims: JettonAmountDictionary, value: bigint, queryId?: bigint): Promise<void>;
|
|
76
|
+
sendWithdrawTon(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
77
|
+
sendWithdrawJettons(provider: ContractProvider, via: Sender, claims: JettonAmountDictionary, value: bigint, queryId?: bigint): Promise<void>;
|
|
78
|
+
getUserContractAddress(provider: ContractProvider, owner: Address, campaignId: number): Promise<Address>;
|
|
79
|
+
}
|
|
80
|
+
export interface JVaultAirdropUserConfig {
|
|
81
|
+
readonly ownerAddress: Address;
|
|
82
|
+
readonly parentAddress: Address;
|
|
83
|
+
readonly campaignId: number;
|
|
84
|
+
readonly publicKey: bigint;
|
|
85
|
+
}
|
|
86
|
+
export declare function buildJVaultAirdropUserData(config: JVaultAirdropUserConfig): Cell;
|
|
87
|
+
export declare class JVaultAirdropUser extends ContractWrapper {
|
|
88
|
+
static createFromAddress(address: Address): JVaultAirdropUser;
|
|
89
|
+
static createFromConfig(config: JVaultAirdropUserConfig, code: Cell, workchain?: number): JVaultAirdropUser;
|
|
90
|
+
sendClaim(provider: ContractProvider, via: Sender, signature: Cell, campaignId: number, owner: Address, previous: Dictionary<bigint, Cell>, next: Dictionary<bigint, Cell>, value: bigint, queryId?: bigint): Promise<void>;
|
|
91
|
+
sendWithdrawTon(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
92
|
+
sendWithdrawJettons(provider: ContractProvider, via: Sender, claims: JettonAmountDictionary, value: bigint, queryId?: bigint): Promise<void>;
|
|
93
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
94
|
+
}
|
|
95
|
+
export interface JVaultFixedCollectionConfig {
|
|
96
|
+
readonly collectionContent: Cell;
|
|
97
|
+
readonly nftItemCode: Cell;
|
|
98
|
+
readonly lockWallet: Address;
|
|
99
|
+
readonly rewardsWallet: Address;
|
|
100
|
+
readonly stakingParams: Dictionary<number, bigint>;
|
|
101
|
+
readonly minimumDeposit: bigint;
|
|
102
|
+
readonly commissionFactor: number;
|
|
103
|
+
readonly admin: Address;
|
|
104
|
+
readonly creator: Address;
|
|
105
|
+
}
|
|
106
|
+
export declare function buildJVaultFixedCollectionData(config: JVaultFixedCollectionConfig): Cell;
|
|
107
|
+
export declare class JVaultFixedStakingCollection extends ContractWrapper {
|
|
108
|
+
static createFromAddress(address: Address): JVaultFixedStakingCollection;
|
|
109
|
+
static createFromConfig(config: JVaultFixedCollectionConfig, code: Cell, workchain?: number): JVaultFixedStakingCollection;
|
|
110
|
+
sendMint(provider: ContractProvider, via: Sender, itemIndex: bigint, owner: Address, content: Cell, value: bigint, queryId?: bigint, itemValue?: bigint): Promise<void>;
|
|
111
|
+
sendBatchMint(provider: ContractProvider, via: Sender, nfts: Dictionary<bigint, Cell>, value: bigint, queryId?: bigint): Promise<void>;
|
|
112
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
113
|
+
}
|
|
114
|
+
export declare class JVaultFixedStakingNftItem extends ContractWrapper {
|
|
115
|
+
static createFromAddress(address: Address): JVaultFixedStakingNftItem;
|
|
116
|
+
sendTransfer(provider: ContractProvider, via: Sender, newOwner: Address, value: bigint, queryId?: bigint, responseDestination?: Address | null, forwardAmount?: bigint): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
export declare class JVaultFloatingStakingCollection extends ContractWrapper {
|
|
119
|
+
static createFromAddress(address: Address): JVaultFloatingStakingCollection;
|
|
120
|
+
sendSetWalletAddress(provider: ContractProvider, via: Sender, walletAddress: Address, value: bigint, queryId?: bigint): Promise<void>;
|
|
121
|
+
sendGetStorageData(provider: ContractProvider, via: Sender, toAddress: Address, value: bigint, queryId?: bigint): Promise<void>;
|
|
122
|
+
sendChangeStartTime(provider: ContractProvider, via: Sender, startTime: number, value: bigint, queryId?: bigint): Promise<void>;
|
|
123
|
+
sendClosePremint(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
124
|
+
sendWithdrawRewards(provider: ContractProvider, via: Sender, amount: bigint, value: bigint, queryId?: bigint): Promise<void>;
|
|
125
|
+
sendWithdrawAccidentJettons(provider: ContractProvider, via: Sender, wallet: Address, amount: bigint, value: bigint, queryId?: bigint): Promise<void>;
|
|
126
|
+
sendWithdrawTon(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
127
|
+
getCollectionData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
128
|
+
getNftContent(provider: ContractProvider, index: bigint): Promise<string>;
|
|
129
|
+
getVersion(provider: ContractProvider): Promise<bigint>;
|
|
130
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
131
|
+
getNftAddressByIndex(provider: ContractProvider, index: bigint): Promise<Address>;
|
|
132
|
+
getNftRewards(provider: ContractProvider, locked: bigint, distributed: bigint): Promise<bigint>;
|
|
133
|
+
}
|
|
134
|
+
export declare class JVaultFloatingStakingNftItem extends ContractWrapper {
|
|
135
|
+
static createFromAddress(address: Address): JVaultFloatingStakingNftItem;
|
|
136
|
+
sendClaim(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
137
|
+
sendWithdraw(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
138
|
+
sendTransfer(provider: ContractProvider, via: Sender, owner: Address, value: bigint, queryId?: bigint, forwardPayload?: Cell): Promise<void>;
|
|
139
|
+
}
|
|
140
|
+
export declare class JVaultIcoSale extends ContractWrapper {
|
|
141
|
+
static createFromAddress(address: Address): JVaultIcoSale;
|
|
142
|
+
sendBuy(provider: ContractProvider, via: Sender, value: bigint, referrer?: Address): Promise<void>;
|
|
143
|
+
sendEndSale(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
144
|
+
sendChangeOwner(provider: ContractProvider, via: Sender, owner: Address, value: bigint, queryId?: bigint): Promise<void>;
|
|
145
|
+
sendChangePurchaseInfo(provider: ContractProvider, via: Sender, purchaseConditions: Cell, value: bigint, queryId?: bigint): Promise<void>;
|
|
146
|
+
sendAddRefAddresses(provider: ContractProvider, via: Sender, refs: Dictionary<bigint, JVaultReferenceTerms>, value: bigint, queryId?: bigint): Promise<void>;
|
|
147
|
+
sendDeployRefs(provider: ContractProvider, via: Sender, startAddress: Address | null, value: bigint, queryId?: bigint): Promise<void>;
|
|
148
|
+
getJettonData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
149
|
+
getWalletAddress(provider: ContractProvider, owner: Address): Promise<Address>;
|
|
150
|
+
getRefAddress(provider: ContractProvider, owner: Address): Promise<Address>;
|
|
151
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
152
|
+
}
|
|
153
|
+
export interface JVaultReferenceTerms {
|
|
154
|
+
readonly discountFactor: number;
|
|
155
|
+
readonly cashbackFactor: number;
|
|
156
|
+
}
|
|
157
|
+
/** The decentralized-launchpad contracts key referrer maps by address hash. */
|
|
158
|
+
export declare function buildJVaultReferenceDictionary(refs: ReadonlyMap<Address, JVaultReferenceTerms>): Dictionary<bigint, JVaultReferenceTerms>;
|
|
159
|
+
export interface JVaultRefWalletConfig {
|
|
160
|
+
readonly ownerAddress: Address;
|
|
161
|
+
readonly collectionAddress: Address;
|
|
162
|
+
readonly saleEndTime: number;
|
|
163
|
+
}
|
|
164
|
+
export declare function buildJVaultRefWalletData(config: JVaultRefWalletConfig): Cell;
|
|
165
|
+
export declare class JVaultRefWallet extends ContractWrapper {
|
|
166
|
+
static createFromAddress(address: Address): JVaultRefWallet;
|
|
167
|
+
static createFromConfig(config: JVaultRefWalletConfig, code: Cell, workchain?: number): JVaultRefWallet;
|
|
168
|
+
sendClaimRef(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
169
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
170
|
+
}
|
|
171
|
+
export interface JVaultSftItemConfig {
|
|
172
|
+
readonly index: bigint;
|
|
173
|
+
readonly collectionAddress: Address;
|
|
174
|
+
}
|
|
175
|
+
export declare function buildJVaultSftItemData(config: JVaultSftItemConfig): Cell;
|
|
176
|
+
export interface JVaultSftItemUpdate {
|
|
177
|
+
readonly jettonsToPurchase: bigint;
|
|
178
|
+
readonly collectedTon: bigint;
|
|
179
|
+
readonly maxCollectedTon: bigint;
|
|
180
|
+
readonly buyerAddress: Address;
|
|
181
|
+
readonly firstUnlockTime: number;
|
|
182
|
+
readonly firstUnlockSize: number;
|
|
183
|
+
readonly cycleLength: number;
|
|
184
|
+
readonly cyclesNumber: number;
|
|
185
|
+
readonly refData?: Cell | null;
|
|
186
|
+
readonly changeInvitee: boolean;
|
|
187
|
+
}
|
|
188
|
+
export declare function buildJVaultSftItemUpdateBody(update: JVaultSftItemUpdate, queryId?: bigint): Cell;
|
|
189
|
+
export declare class JVaultLaunchpadSftItem extends ContractWrapper {
|
|
190
|
+
static createFromAddress(address: Address): JVaultLaunchpadSftItem;
|
|
191
|
+
static createFromConfig(config: JVaultSftItemConfig, code: Cell, workchain?: number): JVaultLaunchpadSftItem;
|
|
192
|
+
sendUpdate(provider: ContractProvider, via: Sender, update: JVaultSftItemUpdate, value: bigint, queryId?: bigint): Promise<void>;
|
|
193
|
+
sendClaim(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
194
|
+
sendRequestRefund(provider: ContractProvider, via: Sender, value: bigint, queryId?: bigint): Promise<void>;
|
|
195
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
196
|
+
}
|
|
197
|
+
export declare class JVaultSaleAdmin extends ContractWrapper {
|
|
198
|
+
static createFromAddress(address: Address): JVaultSaleAdmin;
|
|
199
|
+
sendDeploySale(provider: ContractProvider, via: Sender, saleConfig: Cell, value: bigint): Promise<void>;
|
|
200
|
+
sendChangeJettonWallet(provider: ContractProvider, via: Sender, jettonWallet: Address, value: bigint, queryId?: bigint): Promise<void>;
|
|
201
|
+
sendChangeCodes(provider: ContractProvider, via: Sender, icoSaleCode: Cell, sftItemCode: Cell, refWalletCode: Cell, value: bigint, queryId?: bigint): Promise<void>;
|
|
202
|
+
sendSetCode(provider: ContractProvider, via: Sender, saleAdminCode: Cell, value: bigint, queryId?: bigint): Promise<void>;
|
|
203
|
+
getStorageData(provider: ContractProvider): Promise<import("@ton/core").TupleReader>;
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { uint256CoinsDictionary };
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { uint256CoinsDictionary } from "../codecs.mjs";
|
|
2
|
+
import { NFT_OPCODES } from "../../nft/index.mjs";
|
|
3
|
+
import { ContractWrapper } from "./base.mjs";
|
|
4
|
+
import { Cell, Dictionary, beginCell, contractAddress } from "@ton/core";
|
|
5
|
+
//#region src/contracts/wrappers/jvault-protocols.ts
|
|
6
|
+
/** Exact source revisions for the JVault repositories. */
|
|
7
|
+
const JVAULT_SOURCE_REVISIONS = {
|
|
8
|
+
stakingV2: "f7e83860ba7138c88bf63da13884f54d04589191",
|
|
9
|
+
vesting: "b6d80efdbbeeeda4113ebc9d08c942b543b6b6b6",
|
|
10
|
+
airdrop: "54edd36d242295699278b5668514dd6f2b10260d",
|
|
11
|
+
decentralizedLaunchpad: "83f59e126e5e885f2d7da792998a5d569c0aa944",
|
|
12
|
+
floatingStaking: "51c86b4469fd99b3e2ebdff6f8cdad9fee067b4c",
|
|
13
|
+
fixedStaking: "63cbc8137a7dca0269bcdd9089a9dcc37acbb727"
|
|
14
|
+
};
|
|
15
|
+
const OP = {
|
|
16
|
+
claim: 2808733223,
|
|
17
|
+
withdrawTon: 930245595,
|
|
18
|
+
withdrawJetton: 297834114,
|
|
19
|
+
proveOwnership: 81711432,
|
|
20
|
+
takeExcess: 3510031283,
|
|
21
|
+
burnLockedJettons: 1814361107,
|
|
22
|
+
updateVestingCode: 3746502603,
|
|
23
|
+
changeCreationFee: 1627537649,
|
|
24
|
+
changeContent: 247632384,
|
|
25
|
+
changeFactoryCode: 3805467153,
|
|
26
|
+
initialize: 3624791682,
|
|
27
|
+
transferNft: 1607220500,
|
|
28
|
+
claimNft: 2808733223,
|
|
29
|
+
withdrawNft: 3051249566,
|
|
30
|
+
changeStartTime: 2228344912,
|
|
31
|
+
closePremint: 213450974,
|
|
32
|
+
withdrawRewards: 7,
|
|
33
|
+
withdrawAccidentJettons: 9,
|
|
34
|
+
changeStateNft: 3701725772,
|
|
35
|
+
deployIcoSale: 382519873,
|
|
36
|
+
changeOwner: 2477808433,
|
|
37
|
+
changePurchaseInfo: 2816294541,
|
|
38
|
+
addRefAddresses: 2061877706,
|
|
39
|
+
endSale: 3414277128,
|
|
40
|
+
deployRefs: 3590818427,
|
|
41
|
+
claimRef: 528174657,
|
|
42
|
+
requestRefund: 276158371,
|
|
43
|
+
updateSbtData: 3701725772,
|
|
44
|
+
changeJettonWallet: 2015065302,
|
|
45
|
+
changeCodes: 3112008704,
|
|
46
|
+
setCode: 65535
|
|
47
|
+
};
|
|
48
|
+
const header = (op, queryId = 0n) => beginCell().storeUint(op, 32).storeUint(queryId, 64);
|
|
49
|
+
function buildJVaultVestingData(config) {
|
|
50
|
+
const root = beginCell().storeAddress(config.factoryAddress).storeUint(config.index, 128);
|
|
51
|
+
if (!config.ownerAddress || !config.jettonMinterAddress) return root.endCell();
|
|
52
|
+
return root.storeAddress(config.ownerAddress).storeAddress(config.jettonMinterAddress).storeMaybeRef(config.content ?? null).storeRef(beginCell().storeAddress(config.jettonWalletAddress ?? null).storeAddress(config.factoryJettonWallet ?? null).storeCoins(config.lockedJettons ?? 0n).storeBit(config.jettonsLocked ?? false).storeUint(config.claimedTimes ?? 0, 32).storeCoins(config.claimedJettons ?? 0n).storeUint(config.firstUnlockTime ?? 0, 32).storeUint(config.firstUnlockSize ?? 0, 32).storeUint(config.cycleLength ?? 0, 32).storeUint(config.cyclesNumber ?? 0, 32).endCell()).endCell();
|
|
53
|
+
}
|
|
54
|
+
var JVaultVesting = class JVaultVesting extends ContractWrapper {
|
|
55
|
+
static createFromAddress(address) {
|
|
56
|
+
return new JVaultVesting(address);
|
|
57
|
+
}
|
|
58
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
59
|
+
const init = {
|
|
60
|
+
code,
|
|
61
|
+
data: buildJVaultVestingData(config)
|
|
62
|
+
};
|
|
63
|
+
return new JVaultVesting(contractAddress(workchain, init), init);
|
|
64
|
+
}
|
|
65
|
+
async sendClaim(provider, via, value, queryId = 0n) {
|
|
66
|
+
await this.send(provider, via, value, header(OP.claim, queryId).endCell());
|
|
67
|
+
}
|
|
68
|
+
async sendBurnLockedJettons(provider, via, value, amount, queryId = 0n) {
|
|
69
|
+
const body = header(OP.burnLockedJettons, queryId);
|
|
70
|
+
await this.send(provider, via, value, (amount === void 0 ? body : body.storeCoins(amount)).endCell());
|
|
71
|
+
}
|
|
72
|
+
async sendWithdrawJetton(provider, via, value, wallet, amount, queryId = 0n) {
|
|
73
|
+
await this.send(provider, via, value, header(OP.withdrawJetton, queryId).storeAddress(wallet).storeCoins(amount).endCell());
|
|
74
|
+
}
|
|
75
|
+
async sendProveOwnership(provider, via, value, destination, payload, withContent, queryId = 0n) {
|
|
76
|
+
await this.send(provider, via, value, header(OP.proveOwnership, queryId).storeAddress(destination).storeRef(payload).storeBit(withContent).endCell());
|
|
77
|
+
}
|
|
78
|
+
async sendTakeExcess(provider, via, value, queryId = 0n) {
|
|
79
|
+
await this.send(provider, via, value, header(OP.takeExcess, queryId).endCell());
|
|
80
|
+
}
|
|
81
|
+
async getStorageData(provider) {
|
|
82
|
+
return this.get(provider, "get_storage_data");
|
|
83
|
+
}
|
|
84
|
+
async getNftData(provider) {
|
|
85
|
+
return this.get(provider, "get_nft_data");
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function buildJVaultVestingFactoryData(config) {
|
|
89
|
+
return beginCell().storeAddress(config.adminAddress).storeUint(config.startIndex, 128).storeCoins(config.creationFee).storeDict(config.vestingCodes).storeMaybeRef(config.content ?? null).storeUint(config.version, 8).endCell();
|
|
90
|
+
}
|
|
91
|
+
/** Builds the HashmapE(128, Slice) used by the vesting factory code registry. */
|
|
92
|
+
function buildJVaultVestingCodeDictionary(codes) {
|
|
93
|
+
const dictionary = Dictionary.empty(Dictionary.Keys.BigUint(128), {
|
|
94
|
+
serialize: (slice, builder) => builder.storeSlice(slice),
|
|
95
|
+
parse: (slice) => slice
|
|
96
|
+
});
|
|
97
|
+
for (const [index, code] of codes) dictionary.set(index, code.beginParse());
|
|
98
|
+
return dictionary;
|
|
99
|
+
}
|
|
100
|
+
var JVaultVestingFactory = class JVaultVestingFactory extends ContractWrapper {
|
|
101
|
+
static createFromAddress(address) {
|
|
102
|
+
return new JVaultVestingFactory(address);
|
|
103
|
+
}
|
|
104
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
105
|
+
const init = {
|
|
106
|
+
code,
|
|
107
|
+
data: buildJVaultVestingFactoryData(config)
|
|
108
|
+
};
|
|
109
|
+
return new JVaultVestingFactory(contractAddress(workchain, init), init);
|
|
110
|
+
}
|
|
111
|
+
async sendDeployVesting(provider, via, value, payload) {
|
|
112
|
+
await this.send(provider, via, value, payload);
|
|
113
|
+
}
|
|
114
|
+
async sendUpdateVestingCode(provider, via, code, value) {
|
|
115
|
+
await this.send(provider, via, value, header(OP.updateVestingCode).storeMaybeRef(code).endCell());
|
|
116
|
+
}
|
|
117
|
+
async sendChangeCreationFee(provider, via, fee, value) {
|
|
118
|
+
await this.send(provider, via, value, header(OP.changeCreationFee).storeCoins(fee).endCell());
|
|
119
|
+
}
|
|
120
|
+
async sendChangeContent(provider, via, content, value) {
|
|
121
|
+
await this.send(provider, via, value, header(OP.changeContent).storeMaybeRef(content).endCell());
|
|
122
|
+
}
|
|
123
|
+
async sendWithdrawTon(provider, via, value) {
|
|
124
|
+
await this.send(provider, via, value, header(OP.withdrawTon).endCell());
|
|
125
|
+
}
|
|
126
|
+
async getStorageData(provider) {
|
|
127
|
+
return this.get(provider, "get_storage_data");
|
|
128
|
+
}
|
|
129
|
+
async getVestingAddress(provider, index) {
|
|
130
|
+
return (await this.get(provider, "get_nft_address_by_index", [{
|
|
131
|
+
type: "int",
|
|
132
|
+
value: index
|
|
133
|
+
}])).readAddress();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
function buildJVaultAirdropMainData(config) {
|
|
137
|
+
return beginCell().storeUint(config.publicKey, 256).storeRef(config.userContractCode).storeAddress(config.adminAddress).endCell();
|
|
138
|
+
}
|
|
139
|
+
var JVaultAirdropMain = class JVaultAirdropMain extends ContractWrapper {
|
|
140
|
+
static createFromAddress(address) {
|
|
141
|
+
return new JVaultAirdropMain(address);
|
|
142
|
+
}
|
|
143
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
144
|
+
const init = {
|
|
145
|
+
code,
|
|
146
|
+
data: buildJVaultAirdropMainData(config)
|
|
147
|
+
};
|
|
148
|
+
return new JVaultAirdropMain(contractAddress(workchain, init), init);
|
|
149
|
+
}
|
|
150
|
+
async sendClaim(provider, via, owner, campaignId, claims, value, queryId = 0n) {
|
|
151
|
+
await this.send(provider, via, value, header(OP.claim, queryId).storeAddress(owner).storeUint(campaignId, 32).storeDict(claims).endCell());
|
|
152
|
+
}
|
|
153
|
+
async sendWithdrawTon(provider, via, value, queryId = 0n) {
|
|
154
|
+
await this.send(provider, via, value, header(OP.withdrawTon, queryId).endCell());
|
|
155
|
+
}
|
|
156
|
+
async sendWithdrawJettons(provider, via, claims, value, queryId = 0n) {
|
|
157
|
+
await this.send(provider, via, value, header(OP.withdrawJetton, queryId).storeDict(claims).endCell());
|
|
158
|
+
}
|
|
159
|
+
async getUserContractAddress(provider, owner, campaignId) {
|
|
160
|
+
return (await this.get(provider, "get_user_contract_address", [{
|
|
161
|
+
type: "slice",
|
|
162
|
+
cell: beginCell().storeAddress(owner).endCell()
|
|
163
|
+
}, {
|
|
164
|
+
type: "int",
|
|
165
|
+
value: BigInt(campaignId)
|
|
166
|
+
}])).readAddress();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function buildJVaultAirdropUserData(config) {
|
|
170
|
+
return beginCell().storeBit(0).storeAddress(config.ownerAddress).storeAddress(config.parentAddress).storeUint(config.campaignId, 32).storeUint(config.publicKey, 256).storeBit(0).endCell();
|
|
171
|
+
}
|
|
172
|
+
var JVaultAirdropUser = class JVaultAirdropUser extends ContractWrapper {
|
|
173
|
+
static createFromAddress(address) {
|
|
174
|
+
return new JVaultAirdropUser(address);
|
|
175
|
+
}
|
|
176
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
177
|
+
const init = {
|
|
178
|
+
code,
|
|
179
|
+
data: buildJVaultAirdropUserData(config)
|
|
180
|
+
};
|
|
181
|
+
return new JVaultAirdropUser(contractAddress(workchain, init), init);
|
|
182
|
+
}
|
|
183
|
+
async sendClaim(provider, via, signature, campaignId, owner, previous, next, value, queryId = 0n) {
|
|
184
|
+
await this.send(provider, via, value, header(OP.claim, queryId).storeRef(signature).storeUint(campaignId, 32).storeAddress(owner).storeDict(previous).storeDict(next).endCell());
|
|
185
|
+
}
|
|
186
|
+
async sendWithdrawTon(provider, via, value, queryId = 0n) {
|
|
187
|
+
await this.send(provider, via, value, header(OP.withdrawTon, queryId).endCell());
|
|
188
|
+
}
|
|
189
|
+
async sendWithdrawJettons(provider, via, claims, value, queryId = 0n) {
|
|
190
|
+
await this.send(provider, via, value, header(OP.withdrawJetton, queryId).storeDict(claims).endCell());
|
|
191
|
+
}
|
|
192
|
+
async getStorageData(provider) {
|
|
193
|
+
return this.get(provider, "get_storage_data");
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
function buildJVaultFixedCollectionData(config) {
|
|
197
|
+
return beginCell().storeUint(0, 33).storeRef(config.nftItemCode).storeRef(config.collectionContent).storeAddress(config.lockWallet).storeAddress(config.rewardsWallet).storeDict(config.stakingParams).storeCoins(config.minimumDeposit).storeUint(config.commissionFactor, 16).storeCoins(0).storeCoins(0).storeRef(beginCell().storeAddress(config.admin).storeAddress(config.creator).endCell()).endCell();
|
|
198
|
+
}
|
|
199
|
+
var JVaultFixedStakingCollection = class JVaultFixedStakingCollection extends ContractWrapper {
|
|
200
|
+
static createFromAddress(address) {
|
|
201
|
+
return new JVaultFixedStakingCollection(address);
|
|
202
|
+
}
|
|
203
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
204
|
+
const init = {
|
|
205
|
+
code,
|
|
206
|
+
data: buildJVaultFixedCollectionData(config)
|
|
207
|
+
};
|
|
208
|
+
return new JVaultFixedStakingCollection(contractAddress(workchain, init), init);
|
|
209
|
+
}
|
|
210
|
+
async sendMint(provider, via, itemIndex, owner, content, value, queryId = 0n, itemValue = 0n) {
|
|
211
|
+
await this.send(provider, via, value, beginCell().storeUint(1, 32).storeUint(queryId, 64).storeUint(itemIndex, 64).storeCoins(itemValue).storeRef(beginCell().storeAddress(owner).storeRef(content).endCell()).endCell());
|
|
212
|
+
}
|
|
213
|
+
async sendBatchMint(provider, via, nfts, value, queryId = 0n) {
|
|
214
|
+
await this.send(provider, via, value, beginCell().storeUint(2, 32).storeUint(queryId, 64).storeDict(nfts).endCell());
|
|
215
|
+
}
|
|
216
|
+
async getStorageData(provider) {
|
|
217
|
+
return this.get(provider, "get_storage_data");
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var JVaultFixedStakingNftItem = class JVaultFixedStakingNftItem extends ContractWrapper {
|
|
221
|
+
static createFromAddress(address) {
|
|
222
|
+
return new JVaultFixedStakingNftItem(address);
|
|
223
|
+
}
|
|
224
|
+
async sendTransfer(provider, via, newOwner, value, queryId = 0n, responseDestination = null, forwardAmount = 0n) {
|
|
225
|
+
await this.send(provider, via, value, beginCell().storeUint(NFT_OPCODES.transfer, 32).storeUint(queryId, 64).storeAddress(newOwner).storeAddress(responseDestination).storeBit(0).storeCoins(forwardAmount).storeBit(0).endCell());
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var JVaultFloatingStakingCollection = class JVaultFloatingStakingCollection extends ContractWrapper {
|
|
229
|
+
static createFromAddress(address) {
|
|
230
|
+
return new JVaultFloatingStakingCollection(address);
|
|
231
|
+
}
|
|
232
|
+
async sendSetWalletAddress(provider, via, walletAddress, value, queryId = 0n) {
|
|
233
|
+
await this.send(provider, via, value, header(3513996288, queryId).storeAddress(walletAddress).endCell());
|
|
234
|
+
}
|
|
235
|
+
async sendGetStorageData(provider, via, toAddress, value, queryId = 0n) {
|
|
236
|
+
await this.send(provider, via, value, header(1535698380, queryId).storeAddress(toAddress).endCell());
|
|
237
|
+
}
|
|
238
|
+
async sendChangeStartTime(provider, via, startTime, value, queryId = 0n) {
|
|
239
|
+
await this.send(provider, via, value, header(OP.changeStartTime, queryId).storeUint(startTime, 32).endCell());
|
|
240
|
+
}
|
|
241
|
+
async sendClosePremint(provider, via, value, queryId = 0n) {
|
|
242
|
+
await this.send(provider, via, value, header(OP.closePremint, queryId).endCell());
|
|
243
|
+
}
|
|
244
|
+
async sendWithdrawRewards(provider, via, amount, value, queryId = 0n) {
|
|
245
|
+
await this.send(provider, via, value, header(OP.withdrawRewards, queryId).storeCoins(amount).endCell());
|
|
246
|
+
}
|
|
247
|
+
async sendWithdrawAccidentJettons(provider, via, wallet, amount, value, queryId = 0n) {
|
|
248
|
+
await this.send(provider, via, value, header(OP.withdrawAccidentJettons, queryId).storeAddress(wallet).storeCoins(amount).endCell());
|
|
249
|
+
}
|
|
250
|
+
async sendWithdrawTon(provider, via, value, queryId = 0n) {
|
|
251
|
+
await this.send(provider, via, value, header(4, queryId).endCell());
|
|
252
|
+
}
|
|
253
|
+
async getCollectionData(provider) {
|
|
254
|
+
return this.get(provider, "get_collection_data");
|
|
255
|
+
}
|
|
256
|
+
async getNftContent(provider, index) {
|
|
257
|
+
return (await this.get(provider, "get_nft_content", [{
|
|
258
|
+
type: "int",
|
|
259
|
+
value: index
|
|
260
|
+
}, {
|
|
261
|
+
type: "cell",
|
|
262
|
+
cell: beginCell().storeBit(1).endCell()
|
|
263
|
+
}])).readCell().beginParse().skip(8).loadStringTail();
|
|
264
|
+
}
|
|
265
|
+
async getVersion(provider) {
|
|
266
|
+
return (await this.get(provider, "get_version")).readBigNumber();
|
|
267
|
+
}
|
|
268
|
+
async getStorageData(provider) {
|
|
269
|
+
return this.get(provider, "get_storage_data");
|
|
270
|
+
}
|
|
271
|
+
async getNftAddressByIndex(provider, index) {
|
|
272
|
+
return (await this.get(provider, "get_nft_address_by_index", [{
|
|
273
|
+
type: "int",
|
|
274
|
+
value: index
|
|
275
|
+
}])).readAddress();
|
|
276
|
+
}
|
|
277
|
+
async getNftRewards(provider, locked, distributed) {
|
|
278
|
+
return (await this.get(provider, "get_nft_rewards", [{
|
|
279
|
+
type: "int",
|
|
280
|
+
value: locked
|
|
281
|
+
}, {
|
|
282
|
+
type: "int",
|
|
283
|
+
value: distributed
|
|
284
|
+
}])).readBigNumber();
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
var JVaultFloatingStakingNftItem = class JVaultFloatingStakingNftItem extends ContractWrapper {
|
|
288
|
+
static createFromAddress(address) {
|
|
289
|
+
return new JVaultFloatingStakingNftItem(address);
|
|
290
|
+
}
|
|
291
|
+
async sendClaim(provider, via, value, queryId = 0n) {
|
|
292
|
+
await this.send(provider, via, value, header(OP.claimNft, queryId).endCell());
|
|
293
|
+
}
|
|
294
|
+
async sendWithdraw(provider, via, value, queryId = 0n) {
|
|
295
|
+
await this.send(provider, via, value, header(OP.withdrawNft, queryId).endCell());
|
|
296
|
+
}
|
|
297
|
+
async sendTransfer(provider, via, owner, value, queryId = 0n, forwardPayload) {
|
|
298
|
+
await this.send(provider, via, value, beginCell().storeUint(NFT_OPCODES.transfer, 32).storeUint(queryId, 64).storeAddress(owner).storeAddress(via.address).storeBit(0).storeCoins(0).storeMaybeRef(forwardPayload).endCell());
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
var JVaultIcoSale = class JVaultIcoSale extends ContractWrapper {
|
|
302
|
+
static createFromAddress(address) {
|
|
303
|
+
return new JVaultIcoSale(address);
|
|
304
|
+
}
|
|
305
|
+
async sendBuy(provider, via, value, referrer) {
|
|
306
|
+
await this.send(provider, via, value, referrer ? beginCell().storeBit(1).storeRef(beginCell().storeAddress(referrer).endCell()).endCell() : Cell.EMPTY);
|
|
307
|
+
}
|
|
308
|
+
async sendEndSale(provider, via, value, queryId = 0n) {
|
|
309
|
+
await this.send(provider, via, value, header(OP.endSale, queryId).endCell());
|
|
310
|
+
}
|
|
311
|
+
async sendChangeOwner(provider, via, owner, value, queryId = 0n) {
|
|
312
|
+
await this.send(provider, via, value, header(OP.changeOwner, queryId).storeAddress(owner).endCell());
|
|
313
|
+
}
|
|
314
|
+
async sendChangePurchaseInfo(provider, via, purchaseConditions, value, queryId = 0n) {
|
|
315
|
+
await this.send(provider, via, value, header(OP.changePurchaseInfo, queryId).storeRef(purchaseConditions).endCell());
|
|
316
|
+
}
|
|
317
|
+
async sendAddRefAddresses(provider, via, refs, value, queryId = 0n) {
|
|
318
|
+
await this.send(provider, via, value, header(OP.addRefAddresses, queryId).storeDict(refs).endCell());
|
|
319
|
+
}
|
|
320
|
+
async sendDeployRefs(provider, via, startAddress, value, queryId = 0n) {
|
|
321
|
+
await this.send(provider, via, value, header(OP.deployRefs, queryId).storeAddress(startAddress).endCell());
|
|
322
|
+
}
|
|
323
|
+
async getJettonData(provider) {
|
|
324
|
+
return this.get(provider, "get_jetton_data");
|
|
325
|
+
}
|
|
326
|
+
async getWalletAddress(provider, owner) {
|
|
327
|
+
return (await this.get(provider, "get_wallet_address", [{
|
|
328
|
+
type: "slice",
|
|
329
|
+
cell: beginCell().storeAddress(owner).endCell()
|
|
330
|
+
}])).readAddress();
|
|
331
|
+
}
|
|
332
|
+
async getRefAddress(provider, owner) {
|
|
333
|
+
return (await this.get(provider, "get_ref_address", [{
|
|
334
|
+
type: "slice",
|
|
335
|
+
cell: beginCell().storeAddress(owner).endCell()
|
|
336
|
+
}])).readAddress();
|
|
337
|
+
}
|
|
338
|
+
async getStorageData(provider) {
|
|
339
|
+
return this.get(provider, "get_storage_data");
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const JVAULT_REFERENCE_VALUE = {
|
|
343
|
+
serialize: (terms, builder) => {
|
|
344
|
+
builder.storeUint(terms.discountFactor, 32).storeUint(terms.cashbackFactor, 32);
|
|
345
|
+
},
|
|
346
|
+
parse: (slice) => ({
|
|
347
|
+
discountFactor: slice.loadUint(32),
|
|
348
|
+
cashbackFactor: slice.loadUint(32)
|
|
349
|
+
})
|
|
350
|
+
};
|
|
351
|
+
/** The decentralized-launchpad contracts key referrer maps by address hash. */
|
|
352
|
+
function buildJVaultReferenceDictionary(refs) {
|
|
353
|
+
const dictionary = Dictionary.empty(Dictionary.Keys.BigUint(256), JVAULT_REFERENCE_VALUE);
|
|
354
|
+
for (const [address, terms] of refs) {
|
|
355
|
+
if (terms.discountFactor < 0 || terms.discountFactor > 4294967295 || terms.cashbackFactor < 0 || terms.cashbackFactor > 4294967295) throw new RangeError("reference factors must fit in uint32");
|
|
356
|
+
dictionary.set(BigInt(`0x${address.hash.toString("hex")}`), terms);
|
|
357
|
+
}
|
|
358
|
+
return dictionary;
|
|
359
|
+
}
|
|
360
|
+
function buildJVaultRefWalletData(config) {
|
|
361
|
+
return beginCell().storeAddress(config.ownerAddress).storeAddress(config.collectionAddress).storeUint(config.saleEndTime, 32).storeBit(0).endCell();
|
|
362
|
+
}
|
|
363
|
+
var JVaultRefWallet = class JVaultRefWallet extends ContractWrapper {
|
|
364
|
+
static createFromAddress(address) {
|
|
365
|
+
return new JVaultRefWallet(address);
|
|
366
|
+
}
|
|
367
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
368
|
+
const init = {
|
|
369
|
+
code,
|
|
370
|
+
data: buildJVaultRefWalletData(config)
|
|
371
|
+
};
|
|
372
|
+
return new JVaultRefWallet(contractAddress(workchain, init), init);
|
|
373
|
+
}
|
|
374
|
+
async sendClaimRef(provider, via, value, queryId = 0n) {
|
|
375
|
+
await this.send(provider, via, value, header(OP.claimRef, queryId).endCell());
|
|
376
|
+
}
|
|
377
|
+
async getStorageData(provider) {
|
|
378
|
+
return this.get(provider, "get_storage_data");
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
function buildJVaultSftItemData(config) {
|
|
382
|
+
return beginCell().storeUint(config.index, 256).storeAddress(config.collectionAddress).endCell();
|
|
383
|
+
}
|
|
384
|
+
function buildJVaultSftItemUpdateBody(update, queryId = 0n) {
|
|
385
|
+
return header(OP.updateSbtData, queryId).storeCoins(update.jettonsToPurchase).storeCoins(update.collectedTon).storeCoins(update.maxCollectedTon).storeAddress(update.buyerAddress).storeUint(update.firstUnlockTime, 32).storeUint(update.firstUnlockSize, 32).storeUint(update.cycleLength, 32).storeUint(update.cyclesNumber, 16).storeBit(update.changeInvitee).storeMaybeRef(update.refData ?? null).endCell();
|
|
386
|
+
}
|
|
387
|
+
var JVaultLaunchpadSftItem = class JVaultLaunchpadSftItem extends ContractWrapper {
|
|
388
|
+
static createFromAddress(address) {
|
|
389
|
+
return new JVaultLaunchpadSftItem(address);
|
|
390
|
+
}
|
|
391
|
+
static createFromConfig(config, code, workchain = 0) {
|
|
392
|
+
const init = {
|
|
393
|
+
code,
|
|
394
|
+
data: buildJVaultSftItemData(config)
|
|
395
|
+
};
|
|
396
|
+
return new JVaultLaunchpadSftItem(contractAddress(workchain, init), init);
|
|
397
|
+
}
|
|
398
|
+
async sendUpdate(provider, via, update, value, queryId = 0n) {
|
|
399
|
+
await this.send(provider, via, value, buildJVaultSftItemUpdateBody(update, queryId));
|
|
400
|
+
}
|
|
401
|
+
async sendClaim(provider, via, value, queryId = 0n) {
|
|
402
|
+
await this.send(provider, via, value, header(OP.claimNft, queryId).endCell());
|
|
403
|
+
}
|
|
404
|
+
async sendRequestRefund(provider, via, value, queryId = 0n) {
|
|
405
|
+
await this.send(provider, via, value, header(OP.requestRefund, queryId).endCell());
|
|
406
|
+
}
|
|
407
|
+
async getStorageData(provider) {
|
|
408
|
+
return this.get(provider, "get_storage_data");
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var JVaultSaleAdmin = class JVaultSaleAdmin extends ContractWrapper {
|
|
412
|
+
static createFromAddress(address) {
|
|
413
|
+
return new JVaultSaleAdmin(address);
|
|
414
|
+
}
|
|
415
|
+
async sendDeploySale(provider, via, saleConfig, value) {
|
|
416
|
+
await this.send(provider, via, value, header(OP.deployIcoSale).storeRef(saleConfig).endCell());
|
|
417
|
+
}
|
|
418
|
+
async sendChangeJettonWallet(provider, via, jettonWallet, value, queryId = 0n) {
|
|
419
|
+
await this.send(provider, via, value, header(OP.changeJettonWallet, queryId).storeAddress(jettonWallet).endCell());
|
|
420
|
+
}
|
|
421
|
+
async sendChangeCodes(provider, via, icoSaleCode, sftItemCode, refWalletCode, value, queryId = 0n) {
|
|
422
|
+
await this.send(provider, via, value, header(OP.changeCodes, queryId).storeRef(icoSaleCode).storeRef(sftItemCode).storeRef(refWalletCode).endCell());
|
|
423
|
+
}
|
|
424
|
+
async sendSetCode(provider, via, saleAdminCode, value, queryId = 0n) {
|
|
425
|
+
await this.send(provider, via, value, header(OP.setCode, queryId).storeRef(saleAdminCode).endCell());
|
|
426
|
+
}
|
|
427
|
+
async getStorageData(provider) {
|
|
428
|
+
return this.get(provider, "get_storage_data");
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
//#endregion
|
|
432
|
+
export { JVAULT_SOURCE_REVISIONS, JVaultAirdropMain, JVaultAirdropUser, JVaultFixedStakingCollection, JVaultFixedStakingNftItem, JVaultFloatingStakingCollection, JVaultFloatingStakingNftItem, JVaultIcoSale, JVaultLaunchpadSftItem, JVaultRefWallet, JVaultSaleAdmin, JVaultVesting, JVaultVestingFactory, buildJVaultAirdropMainData, buildJVaultAirdropUserData, buildJVaultFixedCollectionData, buildJVaultRefWalletData, buildJVaultReferenceDictionary, buildJVaultSftItemData, buildJVaultSftItemUpdateBody, buildJVaultVestingCodeDictionary, buildJVaultVestingData, buildJVaultVestingFactoryData, uint256CoinsDictionary };
|