Skip to content

Commit add38ff

Browse files
committed
nwl collections ton
1 parent f1ffcef commit add38ff

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/helpers/ton/nwl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default [""];

src/helpers/ton/ton-bridge.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface FreezeParams {
3939

4040
export class BridgeContract extends Contract<BridgeOptions, BridgeMethods> {
4141
whiteListedCollections: string[] = [];
42+
nwls: string[] = [];
4243

4344
constructor(provider: HttpProvider, options: BridgeOptions) {
4445
super(provider, options);
@@ -53,6 +54,15 @@ export class BridgeContract extends Contract<BridgeOptions, BridgeMethods> {
5354
return new TextEncoder().encode(encodeURI(uri));
5455
}
5556

57+
async init() {
58+
try {
59+
const nwls = await import("./nwl").catch((_) => undefined);
60+
if (nwls) {
61+
this.nwls.push(...nwls.default);
62+
}
63+
} catch (_) {}
64+
}
65+
5666
async createWithdrawBody(params: WithdrawParams) {
5767
const cell = new Cell();
5868
cell.bits.writeUint(0x5fcc3d14, 32); // transfer op
@@ -120,7 +130,9 @@ export class BridgeContract extends Contract<BridgeOptions, BridgeMethods> {
120130
};
121131

122132
getWhitelist = async () => {
123-
if (this.whiteListedCollections.length) return this.whiteListedCollections;
133+
if (this.whiteListedCollections.length)
134+
return this.whiteListedCollections.concat(this.nwls);
135+
124136
const address = (await this.getAddress()).toString();
125137

126138
const readContract = async (
@@ -165,7 +177,7 @@ export class BridgeContract extends Contract<BridgeOptions, BridgeMethods> {
165177
});
166178
}
167179

168-
return whitelistedCollections;
180+
return whitelistedCollections.concat(this.nwls);
169181
} catch (e: any) {
170182
console.log(e.message, "error when parsing whitelisted collectons");
171183
throw new Error(

src/helpers/ton/ton.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export async function tonHelper(args: TonParams): Promise<TonHelper> {
114114
address: args.bridgeAddr,
115115
burner: args.burnerAddr,
116116
});
117+
bridge.init();
117118

118119
const ton = args.tonweb as TonWeb & TonWallet;
119120
ton.provider.sendBoc = (b) =>

0 commit comments

Comments
 (0)