TS Library for interactions with TON Multi-signature wallets
There are two main classes in this library: MultisigWallet
and Order
.
new MultisigWallet(publicKeys: Buffer[], workchain: number, walletId: number, k: number, opts?: { address?: Address, provider?: ContractProvider, client?: TonClient })
publicKeys
- array of public keys of the wallet ownersworkchain
- workchain to deploy the wallet towalletId
- wallet idk
- number of signatures required to confirm a transactionaddress
- force to use this address as the wallet addressprovider
-ContractProvider
instanceclient
-TonClient
instance
owners
-Dictionary<number, Buffer>
of signatures ownerId => signatureworkchain
- workchain where the wallet is deployedwalletId
- wallet idk
- number of signatures required to confirm a transactionaddress
- wallet addressprovider
-ContractProvider
instance
fromAddress (address: Address, opts: { provider?: ContractProvider, client?: TonClient }): Promise<MultisigWallet>
address
- address of the already deployed walletprovider
-ContractProvider
instanceclient
-TonClient
instance
Static method to create a wallet instance from an already deployed wallet address
deployExternal (provider?: ContractProvider): Promise<void>
provider
-ContractProvider
instance
Deploy this MutlisigWallet
via external message
deployInternal (sender: Sender, value: bigint): Promise<void>
sender
-Sender
instancevalue
- value in nanoTons for deploy message
Deploy this MultisigWallet
via internal message
sendOrder (order: Order, secretKey: Buffer, provider?: ContractProvider): Promise<void>
order
- order to send signed by ownerssecretKey
- secret key of the sender (to rootsign the order)provider
-ContractProvider
instance
Rootsign and send signed order to the wallet
getOwnerIdByPubkey (publicKey: Buffer): number
publicKey
- public key of the owner
Returns owner id by public key
formStateInit (): StateInit
Forms state init for this wallet
new Order(walletId: number, offset?: number)
walletId
- wallet idoffset
- the time in seconds after which the order will expire (automatically updates after eachaddMessage
call)
messages
- array ofMessageWithMode
to be added to the ordersignatures
-Dictionary<number, Buffer>
of signatures ownerId => signaturequerryId
- golbal time until which the order is valid
addMessage (message: MessageRelaxed, mode: number): void
message
- message to add to the ordermode
- mode of the message
Clears all previous signatures, renewing querryId with new time and adds a new message to the order
addSignature (ownerId: number, secretKey: Buffer): void
ownerId
- id of the ownersecretKey
- secret key of the owner
Signs the order with the owner's secret key and adds the signature to the order
unionSignatures (other: Order): void
other
- order to add signatures from
Adds signatures from another order to this one
clearMessages (): void
Clears all messages
clearSignatures (): void
Clears all signatures