Skip to content

Commit

Permalink
Merge pull request #164 from gnolang/feat/custom-signer
Browse files Browse the repository at this point in the history
feat: Add custom signer support
  • Loading branch information
clockworkgr authored Jan 16, 2025
2 parents 11b6c12 + 098f672 commit 0123697
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"dependencies": {
"@cosmjs/ledger-amino": "^0.32.4",
"@gnolang/tm2-js-client": "^1.2.2",
"@gnolang/tm2-js-client": "^1.2.4",
"long": "^5.2.3",
"protobufjs": "^7.4.0"
}
Expand Down
15 changes: 15 additions & 0 deletions src/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
AccountWalletOption,
BroadcastTransactionMap,
CreateWalletOptions,
Signer,
Tx,
TxFee,
Wallet,
Expand Down Expand Up @@ -37,6 +38,20 @@ export class GnoWallet extends Wallet {
return gnoWallet;
};

/**
* Generates a custom signer-based wallet
* @param {Signer} signer the custom signer implementing the Signer interface
* @param {CreateWalletOptions} options the wallet generation options
*/
static override fromSigner = async (signer: Signer): Promise<GnoWallet> => {
const wallet = await Wallet.fromSigner(signer);

const gnoWallet: GnoWallet = new GnoWallet();
gnoWallet.signer = wallet.getSigner();

return gnoWallet;
};

/**
* Generates a bip39 mnemonic-based wallet
* @param {string} mnemonic the bip39 mnemonic
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@
dependencies:
levn "^0.4.1"

"@gnolang/tm2-js-client@^1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@gnolang/tm2-js-client/-/tm2-js-client-1.2.2.tgz#b143a2fb6e76a803412dacdf8c017a031390535f"
integrity sha512-mI+vVulUKawXGono+6udT6VkkKo6E+kX0lcyRIp2Yvk5GwoxoExiKDAY/EYNC3OUKJebjh52nVTVkKZnSfW0GQ==
"@gnolang/tm2-js-client@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@gnolang/tm2-js-client/-/tm2-js-client-1.2.4.tgz#7f7da6f7e8ad7a48e43438b12153e2e74f49b919"
integrity sha512-zZpqtJD4TXi2UKIsTHJ2t3vqPOkfK9eh66+KOvVjYksgsjtEHl1MRFHL5XKlcclTdjq8aG8PTzovnp0hGSWwgA==
dependencies:
"@cosmjs/amino" "^0.32.4"
"@cosmjs/crypto" "^0.32.4"
Expand Down

0 comments on commit 0123697

Please sign in to comment.