Skip to content

Commit 4b86222

Browse files
committed
fix: get new wallet flow working
1 parent 436a83d commit 4b86222

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

packages/plugin-coinbase/src/plugins/massPayments.ts

+8-16
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,12 @@ async function initializeWallet(runtime: IAgentRuntime, networkId: string) {
120120
wallet = await Wallet.create({ networkId });
121121

122122
// Export wallet data directly
123-
const walletData: WalletData = wallet.export(); // Assuming Wallet.export() provides { seed, walletId }
124-
const walletAddress = wallet.getDefaultAddress();
125-
126-
if (runtime.character.settings.secrets) {
127-
runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_HEX_SEED =
128-
walletData.seed;
129-
runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_ID =
130-
walletData.walletId;
131-
} else {
132-
elizaLogger.warn(
133-
"Unable to store wallet details: Secrets object is unavailable."
134-
);
135-
}
136-
123+
const walletData: WalletData = wallet.export();
124+
const walletAddress = await wallet.getDefaultAddress();
125+
runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_HEX_SEED =
126+
walletData.seed;
127+
runtime.character.settings.secrets.COINBASE_GENERATED_WALLET_ID =
128+
walletData.walletId;
137129
// Logging wallet creation
138130
elizaLogger.log("Created and stored new wallet:", walletAddress);
139131
} else {
@@ -327,11 +319,11 @@ export const sendMassPayoutAction: Action = {
327319
const { receivingAddresses, transferAmount, assetId, network } =
328320
transferDetails.object as TransferContent;
329321

330-
const allowedNetworks = ["base", "sol", "eth", "arb", "pol"];
322+
const allowedNetworks = Object.values(Coinbase.networks);
331323

332324
if (
333325
!network ||
334-
!allowedNetworks.includes(network.toLowerCase()) ||
326+
!allowedNetworks.includes(network.toLowerCase() as any) ||
335327
!receivingAddresses?.length ||
336328
transferAmount <= 0 ||
337329
!assetId

packages/plugin-coinbase/src/templates.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ Extract the following details for processing a mass payout using the Coinbase SD
5252
- **transferAmount** (number): The amount to transfer to each address (in the smallest unit, e.g., Wei for ETH).
5353
- **assetId** (string): The asset ID to transfer (e.g., ETH, BTC).
5454
- **network** (string): The blockchain network to use. Allowed values are:
55-
- "base": Base blockchain.
56-
- "sol": Solana.
57-
- "eth": Ethereum.
58-
- "arb": Arbitrum.
59-
- "pol": Polygon.
55+
static networks: {
56+
readonly BaseSepolia: "base-sepolia";
57+
readonly BaseMainnet: "base-mainnet";
58+
readonly EthereumHolesky: "ethereum-holesky";
59+
readonly EthereumMainnet: "ethereum-mainnet";
60+
readonly PolygonMainnet: "polygon-mainnet";
61+
readonly SolanaDevnet: "solana-devnet";
62+
readonly SolanaMainnet: "solana-mainnet";
63+
readonly ArbitrumMainnet: "arbitrum-mainnet";
64+
};
6065
6166
Provide the details in the following JSON format:
6267

0 commit comments

Comments
 (0)