ton-org / ton

Most popular TON Typescript Library
MIT License
185 stars 46 forks source link

How to create wallet version W5 or V4R2 #59

Open arsen00531 opened 2 months ago

arsen00531 commented 2 months ago

There is no this versions of wallet

Mohammad10327 commented 2 months ago

Many

Mohammad10327 commented 2 months ago

Money 💰

peng-huang-ch commented 2 months ago

You can find the codes for the wallets here.

import { internal, SendMode, TonClient, WalletContractV3R2, WalletContractV4, WalletContractV5R1, OpenedContract } from '@ton/ton';
// v4r2 wallet
async function walletV4R2(keyPair: KeyPair) {
  const workchain = 0; // Usually you need a workchain 0
  // Create wallet contract
  const wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey });
  const contract = client.open(wallet);
  return contract;
}

// v5r1 wallet
async function walletV5R1(keyPair: KeyPair) {
  // Create wallet contract
  const wallet = WalletContractV5R1.create({ publicKey: keyPair.publicKey });
  return client.open(wallet);
}