File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export const nearAccountFromAccountId = async (
35
35
return createNearAccount ( accountId , network ) ;
36
36
} ;
37
37
38
- const createNearAccount = async (
38
+ export const createNearAccount = async (
39
39
accountId : string ,
40
40
network : NearConfig ,
41
41
keyPair ?: KeyPair
Original file line number Diff line number Diff line change
1
+ import { KeyPair } from "near-api-js" ;
2
+ import { NearEthAdapter } from "./chains/ethereum" ;
3
+ import { MultichainContract } from "./mpcContract" ;
4
+ import { NearConfig } from "near-api-js/lib/near" ;
5
+ import { createNearAccount } from "./chains/near" ;
6
+
1
7
export * from "./chains/ethereum" ;
2
8
export * from "./chains/near" ;
3
9
export * from "./mpcContract" ;
4
10
export * from "./types/types" ;
5
11
export * from "./utils/signature" ;
6
12
export * from "./network" ;
13
+
14
+ interface SetupConfig {
15
+ accountId : string ;
16
+ network : NearConfig ;
17
+ privateKey ?: string ;
18
+ mpcContractId ?: string ;
19
+ derivationPath ?: string ;
20
+ }
21
+
22
+ export async function setupAdapter ( args : SetupConfig ) : Promise < NearEthAdapter > {
23
+ const { privateKey, mpcContractId, derivationPath } = args ;
24
+ const account = await createNearAccount (
25
+ args . accountId ,
26
+ args . network ,
27
+ privateKey ? KeyPair . fromString ( privateKey ) : undefined
28
+ ) ;
29
+ return NearEthAdapter . fromConfig ( {
30
+ mpcContract : new MultichainContract ( account , mpcContractId ) ,
31
+ derivationPath : derivationPath || "ethereum,1" ,
32
+ } ) ;
33
+ }
You can’t perform that action at this time.
0 commit comments