Skip to content

Commit

Permalink
feat: added cosmos-tee-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal-kanna committed Dec 31, 2024
1 parent 902280a commit 7736ec0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion packages/plugin-cosmos/src/actions/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { getCosmosWalletKey } from "../keypairUtils.ts";

import { connectWallet, estimateGas } from "../providers/wallet";
import { StdFee } from "@cosmjs/stargate";
import { c } from "vitest/dist/reporters-5f784f42.js";

/**
* Example interface for user-specified Cosmos transfer details.
Expand Down
22 changes: 12 additions & 10 deletions packages/plugin-cosmos/src/providers/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { SigningStargateClient, StdFee } from "@cosmjs/stargate";
import { getOfflineSignerProto as getOfflineSigner } from "cosmjs-utils";
import { IAgentRuntime, Memory, Provider, State } from "@elizaos/core";
import { TEEMode } from "@elizaos/plugin-cosmos-tee";
import { DirectSecp256k1Wallet } from "@cosmjs/proto-signing";
import {
DirectSecp256k1HdWallet,
DirectSecp256k1Wallet,
} from "@cosmjs/proto-signing";

/** Minimal CosmosChainInfo shape */
export interface CosmosChainInfo {
Expand Down Expand Up @@ -153,17 +156,18 @@ export async function connectWallet(
);
}

// Create offline signer with the mnemonic
signer = await getOfflineSigner({
mnemonic,
chain: chainInfo,
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
prefix: "osmo",
});

console.log("signer>>>>>>>>>>>>..", signer);
// Create offline signer with the mnemonic
// signer = await getOfflineSigner({
// mnemonic,
// chain: chainInfo,
// });
signer = wallet;
}

console.log("signer>>>>>>>>.", signer);

// Connect Stargate client
const stargateClient = await SigningStargateClient.connectWithSigner(
rpcUrl,
Expand All @@ -174,8 +178,6 @@ export async function connectWallet(
const [account] = await signer.getAccounts();
signerAddress = account.address;

console.log("signerAddress>>>>>>", signerAddress);

console.log(
`connectWallet: Connected to chain '${chainInfo.chain_name}', address: ${signerAddress}`
);
Expand Down

0 comments on commit 7736ec0

Please sign in to comment.