Skip to content

Commit

Permalink
KeyPairString
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Aug 23, 2024
1 parent c69fd4e commit 8a71186
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export * from "./utils/transaction";
/// Beta features
export * from "./beta";

type KeyPairString = `ed25519:${string}` | `secp256k1:${string}`;

/**
* Configuration for setting up the adapter.
*
Expand All @@ -31,7 +33,7 @@ interface SetupConfig {
accountId: string;
mpcContractId: string;
network?: NearConfig;
privateKey?: `ed25519:${string}` | `secp256k1:${string}`;
privateKey?: string;
derivationPath?: string;
}

Expand All @@ -57,7 +59,7 @@ export async function setupAdapter(args: SetupConfig): Promise<NearEthAdapter> {
accountId,
config,
// Without private key, MPC contract connection is read-only.
privateKey ? KeyPair.fromString(privateKey) : undefined
privateKey ? KeyPair.fromString(privateKey as KeyPairString) : undefined
);
} catch (error: unknown) {
console.error(`Failed to create NEAR account: ${error}`);
Expand Down

0 comments on commit 8a71186

Please sign in to comment.