Layer 231
method
wallet.replaceWallet#d8c72eec flags:# wallet:InputWalletReplacement password:flags.0?InputCheckPasswordSRP = WalletState;

Parameters

Name Type Description
Wallet InputWalletReplacement Replacement wallet: input Wallet New to create a new one, or input Wallet Imported with the imported wallet's public key and ownership proof
Password flags.0?InputCheckPasswordSRP SRP proof of the user's 2 FA password, if required

Returns

WalletState

Gogram Example

// Import an existing TON wallet. importedPub is its public key; tonProofSignature signs
// the wallet.getProofChallenge payload with the matching private key.
pwd, _ := client.AccountGetPassword()
srp, _ := tg.GetInputCheckPassword("my-2fa-password", pwd)
state, err := client.WalletReplaceWallet(&tg.InputWalletImported{
	PublicKey: importedPub,
	Proof:     &tg.WalletOwnershipProof{Timestamp: int32(time.Now().Unix()), Signature: tonProofSignature},
}, srp)
if err != nil {
	log.Fatal(err)
}
if s, ok := state.(*tg.WalletStateObj); ok {
	fmt.Println("active wallet:", s.Address)
}
// Use &tg.InputWalletNew{} to create a fresh wallet instead.