Skip to content

Commit

Permalink
wallet-ext: send coins (MystenLabs#2365)
Browse files Browse the repository at this point in the history
  • Loading branch information
pchrysochoidis authored Jun 1, 2022
1 parent bfa6d76 commit 9e32d85
Show file tree
Hide file tree
Showing 17 changed files with 747 additions and 20 deletions.
177 changes: 171 additions & 6 deletions wallet/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"bootstrap-icons": "^1.8.2",
"buffer": "^6.0.3",
"classnames": "^2.3.1",
"formik": "^2.2.9",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-intl": "^6.0.2",
Expand All @@ -84,6 +85,7 @@
"rxjs": "^7.5.5",
"stream-browserify": "^3.0.0",
"tweetnacl": "^1.0.3",
"webextension-polyfill": "^0.9.0"
"webextension-polyfill": "^0.9.0",
"yup": "^0.32.11"
}
}
6 changes: 6 additions & 0 deletions wallet/src/shared/formatting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

export const balanceFormatOptions = {
maximumFractionDigits: 0,
};
12 changes: 11 additions & 1 deletion wallet/src/ui/app/ApiProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { JsonRpcProvider } from '@mysten/sui.js';
import { JsonRpcProvider, RawSigner } from '@mysten/sui.js';

import type { Ed25519Keypair } from '@mysten/sui.js';

export enum API_ENV {
local = 'local',
Expand Down Expand Up @@ -34,6 +36,7 @@ export const DEFAULT_API_ENDPOINT = getDefaultAPI(DEFAULT_API_ENV);

export default class ApiProvider {
private _apiProvider: JsonRpcProvider;
private _signer: RawSigner | null = null;

constructor() {
this._apiProvider = new JsonRpcProvider(DEFAULT_API_ENDPOINT);
Expand All @@ -42,4 +45,11 @@ export default class ApiProvider {
public get instance() {
return this._apiProvider;
}

public getSignerInstance(keypair: Ed25519Keypair): RawSigner {
if (!this._signer) {
this._signer = new RawSigner(keypair, this._apiProvider);
}
return this._signer;
}
}
Loading

0 comments on commit 9e32d85

Please sign in to comment.