mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-28 15:45:50 +00:00
chore(code-samples): remove all emojis
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fmt"
|
||||
|
||||
"github.com/Peersyst/xrpl-go/pkg/crypto"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/faucet"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/rpc"
|
||||
transactions "github.com/Peersyst/xrpl-go/xrpl/transaction"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/transaction/types"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/wallet"
|
||||
"github.com/Peersyst/xrpl-go/pkg/crypto"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/faucet"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/rpc"
|
||||
transactions "github.com/Peersyst/xrpl-go/xrpl/transaction"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/transaction/types"
|
||||
"github.com/Peersyst/xrpl-go/xrpl/wallet"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,41 +32,41 @@ func main() {
|
||||
//
|
||||
// Configure wallets
|
||||
//
|
||||
fmt.Println("⏳ Setting up wallets...")
|
||||
fmt.Println("Setting up wallets...")
|
||||
coldWallet, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error creating cold wallet: %s\n", err)
|
||||
fmt.Printf("Error creating cold wallet: %s\n", err)
|
||||
return
|
||||
}
|
||||
err = client.FundWallet(&coldWallet)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error funding cold wallet: %s\n", err)
|
||||
fmt.Printf("Error funding cold wallet: %s\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("💸 Cold wallet funded!")
|
||||
fmt.Println("Cold wallet funded!")
|
||||
|
||||
hotWallet, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error creating hot wallet: %s\n", err)
|
||||
fmt.Printf("Error creating hot wallet: %s\n", err)
|
||||
return
|
||||
}
|
||||
err = client.FundWallet(&hotWallet)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error funding hot wallet: %s\n", err)
|
||||
fmt.Printf("Error funding hot wallet: %s\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("💸 Hot wallet funded!")
|
||||
fmt.Println("Hot wallet funded!")
|
||||
fmt.Println()
|
||||
|
||||
fmt.Println("✅ Wallets setup complete!")
|
||||
fmt.Println("💳 Cold wallet:", coldWallet.ClassicAddress)
|
||||
fmt.Println("💳 Hot wallet:", hotWallet.ClassicAddress)
|
||||
fmt.Println("Wallets setup complete!")
|
||||
fmt.Println("Cold wallet:", coldWallet.ClassicAddress)
|
||||
fmt.Println("Hot wallet:", hotWallet.ClassicAddress)
|
||||
fmt.Println()
|
||||
|
||||
//
|
||||
// Configure cold address settings
|
||||
//
|
||||
fmt.Println("⏳ Configuring cold address settings...")
|
||||
fmt.Println("Configuring cold address settings...")
|
||||
coldWalletAccountSet := &transactions.AccountSet{
|
||||
BaseTx: transactions.BaseTx{
|
||||
Account: types.Address(coldWallet.ClassicAddress),
|
||||
@@ -85,37 +85,37 @@ func main() {
|
||||
|
||||
err = client.Autofill(&flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error autofilling transaction: %s\n", err)
|
||||
fmt.Printf("Error autofilling transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
txBlob, _, err := coldWallet.Sign(flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error signing transaction: %s\n", err)
|
||||
fmt.Printf("Error signing transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err := client.SubmitTxBlobAndWait(txBlob, false)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error submitting transaction: %s\n", err)
|
||||
fmt.Printf("Error submitting transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !response.Validated {
|
||||
fmt.Println("❌ Cold wallet unfreezing failed!")
|
||||
fmt.Println("Cold wallet unfreezing failed!")
|
||||
fmt.Println("Try again!")
|
||||
fmt.Println()
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("✅ Cold address settings configured!")
|
||||
fmt.Printf("🌐 Hash: %s\n", response.Hash.String())
|
||||
fmt.Println("Cold address settings configured!")
|
||||
fmt.Printf("Hash: %s\n", response.Hash.String())
|
||||
fmt.Println()
|
||||
|
||||
//
|
||||
// Create trust line from hot to cold address
|
||||
//
|
||||
fmt.Println("⏳ Creating trust line from hot to cold address...")
|
||||
fmt.Println("Creating trust line from hot to cold address...")
|
||||
hotColdTrustSet := &transactions.TrustSet{
|
||||
BaseTx: transactions.BaseTx{
|
||||
Account: types.Address(hotWallet.ClassicAddress),
|
||||
@@ -130,37 +130,37 @@ func main() {
|
||||
flattenedTx = hotColdTrustSet.Flatten()
|
||||
err = client.Autofill(&flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error autofilling transaction: %s\n", err)
|
||||
fmt.Printf("Error autofilling transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
txBlob, _, err = hotWallet.Sign(flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error signing transaction: %s\n", err)
|
||||
fmt.Printf("Error signing transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err = client.SubmitTxBlobAndWait(txBlob, false)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error submitting transaction: %s\n", err)
|
||||
fmt.Printf("Error submitting transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !response.Validated {
|
||||
fmt.Println("❌ Trust line from hot to cold address creation failed!")
|
||||
fmt.Println("Trust line from hot to cold address creation failed!")
|
||||
fmt.Println("Try again!")
|
||||
fmt.Println()
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("✅ Trust line from hot to cold address created!")
|
||||
fmt.Printf("🌐 Hash: %s\n", response.Hash.String())
|
||||
fmt.Println("Trust line from hot to cold address created!")
|
||||
fmt.Printf("Hash: %s\n", response.Hash.String())
|
||||
fmt.Println()
|
||||
|
||||
//
|
||||
// Send tokens from cold wallet to hot wallet
|
||||
//
|
||||
fmt.Println("⏳ Sending tokens from cold wallet to hot wallet...")
|
||||
fmt.Println("Sending tokens from cold wallet to hot wallet...")
|
||||
coldToHotPayment := &transactions.Payment{
|
||||
BaseTx: transactions.BaseTx{
|
||||
Account: types.Address(coldWallet.ClassicAddress),
|
||||
@@ -177,37 +177,37 @@ func main() {
|
||||
flattenedTx = coldToHotPayment.Flatten()
|
||||
err = client.Autofill(&flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error autofilling transaction: %s\n", err)
|
||||
fmt.Printf("Error autofilling transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
txBlob, _, err = coldWallet.Sign(flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error signing transaction: %s\n", err)
|
||||
fmt.Printf("Error signing transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err = client.SubmitTxBlobAndWait(txBlob, false)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error submitting transaction: %s\n", err)
|
||||
fmt.Printf("Error submitting transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !response.Validated {
|
||||
fmt.Println("❌ Tokens not sent from cold wallet to hot wallet!")
|
||||
fmt.Println("Tokens not sent from cold wallet to hot wallet!")
|
||||
fmt.Println("Try again!")
|
||||
fmt.Println()
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("✅ Tokens sent from cold wallet to hot wallet!")
|
||||
fmt.Printf("🌐 Hash: %s\n", response.Hash.String())
|
||||
fmt.Println("Tokens sent from cold wallet to hot wallet!")
|
||||
fmt.Printf("Hash: %s\n", response.Hash.String())
|
||||
fmt.Println()
|
||||
|
||||
//
|
||||
// Claw back tokens from customer one
|
||||
//
|
||||
fmt.Println("⏳ Clawing back tokens from hot wallet...")
|
||||
fmt.Println("Clawing back tokens from hot wallet...")
|
||||
|
||||
coldWalletClawback := &transactions.Clawback{
|
||||
BaseTx: transactions.BaseTx{
|
||||
@@ -223,29 +223,29 @@ func main() {
|
||||
flattenedTx = coldWalletClawback.Flatten()
|
||||
err = client.Autofill(&flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error autofilling transaction: %s\n", err)
|
||||
fmt.Printf("Error autofilling transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
txBlob, _, err = coldWallet.Sign(flattenedTx)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error signing transaction: %s\n", err)
|
||||
fmt.Printf("Error signing transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err = client.SubmitTxBlobAndWait(txBlob, false)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error submitting transaction: %s\n", err)
|
||||
fmt.Printf("Error submitting transaction: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !response.Validated {
|
||||
fmt.Println("❌ Tokens not clawed back from customer one!")
|
||||
fmt.Println("Tokens not clawed back from customer one!")
|
||||
fmt.Println("Try again!")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("✅ Tokens clawed back from customer one!")
|
||||
fmt.Printf("🌐 Hash: %s\n", response.Hash.String())
|
||||
fmt.Println("Tokens clawed back from customer one!")
|
||||
fmt.Printf("Hash: %s\n", response.Hash.String())
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user