How to Withdraw From a Chain
The withdraw
endpoint sends L2 funds owned by the caller to their L1 address.
- Solo
- Solo (Schema)
- Rust (Schema)
- Go (Schema)
// withdraw from chain to wallet
req := solo.NewCallParams(accounts.Contract.Name, accounts.FuncWithdraw.Name)
_, err := chain.PostRequestSync(req.WithMaxAffordableGasBudget(), wallet)
require.NoError(t, err)
// withdraw from chain to wallet
w := coreaccounts.ScFuncs.Withdraw(ctx.Sign(wallet))
w.Func.Post()
require.NoError(t, ctx.Err)
// withdraw from chain to wallet
let w = coreaccounts::ScFuncs::withdraw(ctx.sign(wallet));
w.func.post();
// withdraw from chain to wallet
w := coreaccounts.ScFuncs.Withdraw(ctx.sign(wallet))
w.Func.Post()