使用 TypeScript 与多重签名钱包交互
引言
如果您不知道TON中的多重签名钱包是什么,可以在此处查看。
按照以下步骤操作,您将学习如何:
- 创建并部署多重签名钱包
- 使用该钱包创建、签名并发送交易
我们将创建一个TypeScript项目,并使用ton库,因此您需要首先安装它。我们还将使用ton-access:
yarn add typescript @types/node ton ton-crypto ton-core buffer @orbs-network/ton-access
yarn tsc --init -t es2022
本指南的完整代码可在此处查看:
创建并部署多重签名钱包
首先创建一个源文件,例如main.ts
。在您喜欢的代码编辑器中打开它,然后按照本指南操作!
首先我们需要导入所有重要的东西
import { Address, beginCell, MessageRelaxed, toNano, TonClient, WalletContractV4, MultisigWallet, MultisigOrder, MultisigOrderBuilder } from "ton";
import { KeyPair, mnemonicToPrivateKey } from 'ton-crypto';
import { getHttpEndpoint } from "@orbs-network/ton-access";
创建TonClient
实例 :
const endpoint = await getHttpEndpoint();
const client = new TonClient({ endpoint });