Skip to content

Commit

Permalink
Merge branch 'main' into fix-chain-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus committed Oct 11, 2024
2 parents 20e6977 + df8728c commit 20b51fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"build": "rm -fr dist/* && yarn build:esm && yarn build:cjs",
"build:esm": "tsc -p tsconfig.esm.json",
"build:cjs": "tsc -p tsconfig.cjs.json",
"lint": "eslint . --ignore-pattern dist/",
"lint": "eslint . --ignore-pattern dist/ && prettier --check **/*.ts",
"test": "jest --testTimeout 30000",
"coverage": "yarn test --coverage",
"verify": "yarn lint && yarn coverage unit",
"fmt": "prettier --write '{src,examples,tests}/**/*.{js,jsx,ts,tsx}'"
"fmt": "prettier --write '{src,examples,tests}/**/*.{js,jsx,ts,tsx}' && eslint src/ --fix"
},
"engines": {
"node": ">=20.0.0"
Expand Down
16 changes: 15 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,28 @@ type KeyPairString = `ed25519:${string}` | `secp256k1:${string}`;
* @property {string} [privateKey] - (Optional) The private key for the account.
* @property {string} [derivationPath] - (Optional) The derivation path for the Ethereum account. Defaults to "ethereum,1".
*/
interface SetupConfig {
export interface SetupConfig {
accountId: string;
mpcContractId: string;
network?: NearConfig;
privateKey?: string;
derivationPath?: string;
}

/**
* Sets up the NEAR-Ethereum adapter using the provided configuration.
*
* This function establishes a connection to the NEAR network using the given
* account details, configures the Multi-Party Computation (MPC) contract, and
* returns an instance of the NearEthAdapter.
*
* @param {SetupConfig} args - The configuration parameters for setting up the adapter.
*
* @returns {Promise<NearEthAdapter>} - A promise that resolves to an instance of NearEthAdapter configured with the provided settings.
*
* @throws {Error} - Throws an error if the `accountId` does not match the networkId of the provided or inferred `network`.
* @throws {Error} - Throws an error if there is a failure in creating a NEAR account.
*/
export async function setupAdapter(args: SetupConfig): Promise<NearEthAdapter> {
const {
accountId,
Expand Down

0 comments on commit 20b51fa

Please sign in to comment.