Add Wallet
interface
This commit is contained in:
parent
4b866891ac
commit
4410691a45
BIN
.yarn/cache/@cosmjs-encoding-npm-0.20.1-b7bf48eea6-897c3908ed.zip
vendored
Normal file
BIN
.yarn/cache/@cosmjs-encoding-npm-0.20.1-b7bf48eea6-897c3908ed.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@cosmjs-math-npm-0.20.1-63f5d52048-768abbb5ef.zip
vendored
Normal file
BIN
.yarn/cache/@cosmjs-math-npm-0.20.1-63f5d52048-768abbb5ef.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@cosmjs-utils-npm-0.20.1-d907579625-22502fcdfa.zip
vendored
Normal file
BIN
.yarn/cache/@cosmjs-utils-npm-0.20.1-d907579625-22502fcdfa.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@iov-crypto-npm-2.1.0-dc02dfa437-83eafba9aa.zip
vendored
Normal file
BIN
.yarn/cache/@iov-crypto-npm-2.1.0-dc02dfa437-83eafba9aa.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@iov-encoding-npm-2.1.0-7ce9f20d9c-8269d068b6.zip
vendored
Normal file
BIN
.yarn/cache/@iov-encoding-npm-2.1.0-7ce9f20d9c-8269d068b6.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@iov-encoding-npm-2.5.0-fe71bc8e50-123fa0e87a.zip
vendored
Normal file
BIN
.yarn/cache/@iov-encoding-npm-2.5.0-fe71bc8e50-123fa0e87a.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@iov-utils-npm-2.0.2-35159a4b44-7b95e084d0.zip
vendored
Normal file
BIN
.yarn/cache/@iov-utils-npm-2.0.2-35159a4b44-7b95e084d0.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@keplr-wallet-types-npm-0.11.23-47d40e583e-15c60741f3.zip
vendored
Normal file
BIN
.yarn/cache/@keplr-wallet-types-npm-0.11.23-47d40e583e-15c60741f3.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip
vendored
Normal file
BIN
.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@types-long-npm-4.0.2-e7bdc00dd4-d16cde7240.zip
vendored
Normal file
BIN
.yarn/cache/@types-long-npm-4.0.2-e7bdc00dd4-d16cde7240.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@types-node-npm-11.11.6-40abad0842-075f1c011c.zip
vendored
Normal file
BIN
.yarn/cache/@types-node-npm-11.11.6-40abad0842-075f1c011c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@types-node-npm-18.11.13-8738c466da-b0c1aa3bd2.zip
vendored
Normal file
BIN
.yarn/cache/@types-node-npm-18.11.13-8738c466da-b0c1aa3bd2.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/asynckit-npm-0.4.0-c718858525-7b78c451df.zip
vendored
Normal file
BIN
.yarn/cache/asynckit-npm-0.4.0-c718858525-7b78c451df.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/axios-npm-0.21.1-d192f6b3b3-c87915fa0b.zip
vendored
Normal file
BIN
.yarn/cache/axios-npm-0.21.1-d192f6b3b3-c87915fa0b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/axios-npm-0.27.2-dbe3a48aea-38cb754046.zip
vendored
Normal file
BIN
.yarn/cache/axios-npm-0.27.2-dbe3a48aea-38cb754046.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/bech32-npm-1.1.4-87b69922f7-0e98db6191.zip
vendored
Normal file
BIN
.yarn/cache/bech32-npm-1.1.4-87b69922f7-0e98db6191.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/bip39-npm-3.0.4-7c69c9182f-79ce1600a0.zip
vendored
Normal file
BIN
.yarn/cache/bip39-npm-3.0.4-7c69c9182f-79ce1600a0.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/bn.js-npm-4.12.0-3ec6c884f6-39afb4f15f.zip
vendored
Normal file
BIN
.yarn/cache/bn.js-npm-4.12.0-3ec6c884f6-39afb4f15f.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/brorand-npm-1.1.0-ea86634c4b-8a05c9f3c4.zip
vendored
Normal file
BIN
.yarn/cache/brorand-npm-1.1.0-ea86634c4b-8a05c9f3c4.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/buffer-npm-5.4.3-98085917e7-1067941390.zip
vendored
Normal file
BIN
.yarn/cache/buffer-npm-5.4.3-98085917e7-1067941390.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip
vendored
Normal file
BIN
.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/cipher-base-npm-1.0.4-2e98b97140-47d3568dbc.zip
vendored
Normal file
BIN
.yarn/cache/cipher-base-npm-1.0.4-2e98b97140-47d3568dbc.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-49fa4aeb49.zip
vendored
Normal file
BIN
.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-49fa4aeb49.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/create-hash-npm-1.2.0-afd048e1ce-02a6ae3bb9.zip
vendored
Normal file
BIN
.yarn/cache/create-hash-npm-1.2.0-afd048e1ce-02a6ae3bb9.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/create-hmac-npm-1.1.7-b4ef32668a-ba12bb2257.zip
vendored
Normal file
BIN
.yarn/cache/create-hmac-npm-1.1.7-b4ef32668a-ba12bb2257.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip
vendored
Normal file
BIN
.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/curve25519-js-npm-0.0.4-c068fd8866-e2f31c7d3c.zip
vendored
Normal file
BIN
.yarn/cache/curve25519-js-npm-0.0.4-c068fd8866-e2f31c7d3c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-46fe6e83e2.zip
vendored
Normal file
BIN
.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-46fe6e83e2.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/elliptic-npm-6.5.4-0ca8204a86-d56d21fd04.zip
vendored
Normal file
BIN
.yarn/cache/elliptic-npm-6.5.4-0ca8204a86-d56d21fd04.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/fast-deep-equal-npm-3.1.1-cbd83be021-98bcc0eece.zip
vendored
Normal file
BIN
.yarn/cache/fast-deep-equal-npm-3.1.1-cbd83be021-98bcc0eece.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-faa66059b6.zip
vendored
Normal file
BIN
.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-faa66059b6.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/form-data-npm-4.0.0-916facec2d-01135bf867.zip
vendored
Normal file
BIN
.yarn/cache/form-data-npm-4.0.0-916facec2d-01135bf867.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/hash-base-npm-3.1.0-26fc5711dd-26b7e97ac3.zip
vendored
Normal file
BIN
.yarn/cache/hash-base-npm-3.1.0-26fc5711dd-26b7e97ac3.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/hash.js-npm-1.1.7-f1ad187358-e350096e65.zip
vendored
Normal file
BIN
.yarn/cache/hash.js-npm-1.1.7-f1ad187358-e350096e65.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/hmac-drbg-npm-1.0.1-3499ad31cd-bd30b6a68d.zip
vendored
Normal file
BIN
.yarn/cache/hmac-drbg-npm-1.0.1-3499ad31cd-bd30b6a68d.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/is-buffer-npm-1.1.6-08199d9ccc-4a186d995d.zip
vendored
Normal file
BIN
.yarn/cache/is-buffer-npm-1.1.6-08199d9ccc-4a186d995d.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-crypto-env-npm-0.3.2-7db1ded106-ff4ea77f8c.zip
vendored
Normal file
BIN
.yarn/cache/js-crypto-env-npm-0.3.2-7db1ded106-ff4ea77f8c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-crypto-hash-npm-0.6.3-82cb040974-b173b7307c.zip
vendored
Normal file
BIN
.yarn/cache/js-crypto-hash-npm-0.6.3-82cb040974-b173b7307c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-crypto-hkdf-npm-0.7.3-0e4cb7718e-7a1a07876b.zip
vendored
Normal file
BIN
.yarn/cache/js-crypto-hkdf-npm-0.7.3-0e4cb7718e-7a1a07876b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-crypto-hmac-npm-0.6.3-f44d829bcc-27f7e66ed6.zip
vendored
Normal file
BIN
.yarn/cache/js-crypto-hmac-npm-0.6.3-f44d829bcc-27f7e66ed6.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-crypto-random-npm-0.4.3-b700d72324-39eeb684bb.zip
vendored
Normal file
BIN
.yarn/cache/js-crypto-random-npm-0.4.3-b700d72324-39eeb684bb.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-encoding-utils-npm-0.5.6-c96974e0e9-f0c590d70f.zip
vendored
Normal file
BIN
.yarn/cache/js-encoding-utils-npm-0.5.6-c96974e0e9-f0c590d70f.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/js-sha3-npm-0.8.0-decf3ddcfa-75df77c1fc.zip
vendored
Normal file
BIN
.yarn/cache/js-sha3-npm-0.8.0-decf3ddcfa-75df77c1fc.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/libsodium-npm-0.7.10-047df41812-243794a0b3.zip
vendored
Normal file
BIN
.yarn/cache/libsodium-npm-0.7.10-047df41812-243794a0b3.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/libsodium-wrappers-npm-0.7.10-1e41dfad84-294ac09889.zip
vendored
Normal file
BIN
.yarn/cache/libsodium-wrappers-npm-0.7.10-1e41dfad84-294ac09889.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip
vendored
Normal file
BIN
.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/md5-npm-2.2.1-4596cd8137-2237e583f9.zip
vendored
Normal file
BIN
.yarn/cache/md5-npm-2.2.1-4596cd8137-2237e583f9.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/md5.js-npm-1.3.5-130901125a-098494d885.zip
vendored
Normal file
BIN
.yarn/cache/md5.js-npm-1.3.5-130901125a-098494d885.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/mime-db-npm-1.52.0-b5371d6fd2-0d99a03585.zip
vendored
Normal file
BIN
.yarn/cache/mime-db-npm-1.52.0-b5371d6fd2-0d99a03585.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/mime-types-npm-2.1.35-dd9ea9f3e2-89a5b7f1de.zip
vendored
Normal file
BIN
.yarn/cache/mime-types-npm-2.1.35-dd9ea9f3e2-89a5b7f1de.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/minimalistic-assert-npm-1.0.1-dc8bb23d29-cc7974a926.zip
vendored
Normal file
BIN
.yarn/cache/minimalistic-assert-npm-1.0.1-dc8bb23d29-cc7974a926.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/minimalistic-crypto-utils-npm-1.0.1-e66b10822e-6e8a0422b3.zip
vendored
Normal file
BIN
.yarn/cache/minimalistic-crypto-utils-npm-1.0.1-e66b10822e-6e8a0422b3.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/miscreant-npm-0.3.2-60bfb037cf-36d56023b4.zip
vendored
Normal file
BIN
.yarn/cache/miscreant-npm-0.3.2-60bfb037cf-36d56023b4.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/pako-npm-1.0.11-b8f1b69d3e-1be2bfa1f8.zip
vendored
Normal file
BIN
.yarn/cache/pako-npm-1.0.11-b8f1b69d3e-1be2bfa1f8.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/pbkdf2-npm-3.1.2-d67bbb584f-2c950a100b.zip
vendored
Normal file
BIN
.yarn/cache/pbkdf2-npm-3.1.2-d67bbb584f-2c950a100b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/protobufjs-npm-6.11.3-566fb31188-4a6ce19641.zip
vendored
Normal file
BIN
.yarn/cache/protobufjs-npm-6.11.3-566fb31188-4a6ce19641.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/randombytes-npm-2.1.0-e3da76bccf-d779499376.zip
vendored
Normal file
BIN
.yarn/cache/randombytes-npm-2.1.0-e3da76bccf-d779499376.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-d4ea81502d.zip
vendored
Normal file
BIN
.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-d4ea81502d.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/readonly-date-npm-1.0.0-e93ba2496b-78481e2abf.zip
vendored
Normal file
BIN
.yarn/cache/readonly-date-npm-1.0.0-e93ba2496b-78481e2abf.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/ripemd160-npm-2.0.2-7b1fb8dc76-006accc405.zip
vendored
Normal file
BIN
.yarn/cache/ripemd160-npm-2.0.2-7b1fb8dc76-006accc405.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/safe-buffer-npm-5.2.1-3481c8aa9b-b99c4b41fd.zip
vendored
Normal file
BIN
.yarn/cache/safe-buffer-npm-5.2.1-3481c8aa9b-b99c4b41fd.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/secretjs-npm-0.17.7-e9c142c009-7d6fb503a6.zip
vendored
Normal file
BIN
.yarn/cache/secretjs-npm-0.17.7-e9c142c009-7d6fb503a6.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/secure-random-npm-1.1.2-6970108703-44744464a2.zip
vendored
Normal file
BIN
.yarn/cache/secure-random-npm-1.1.2-6970108703-44744464a2.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/sha.js-npm-2.4.11-14868df4ca-ebd3f59d4b.zip
vendored
Normal file
BIN
.yarn/cache/sha.js-npm-2.4.11-14868df4ca-ebd3f59d4b.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/sha3-npm-2.1.4-a31d85b932-fb49c8e181.zip
vendored
Normal file
BIN
.yarn/cache/sha3-npm-2.1.4-a31d85b932-fb49c8e181.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/string_decoder-npm-1.3.0-2422117fd0-8417646695.zip
vendored
Normal file
BIN
.yarn/cache/string_decoder-npm-1.3.0-2422117fd0-8417646695.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/type-tagger-npm-1.0.0-c3079a834a-2bc0a94e52.zip
vendored
Normal file
BIN
.yarn/cache/type-tagger-npm-1.0.0-c3079a834a-2bc0a94e52.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/unorm-npm-1.6.0-43467eccf1-9a86546256.zip
vendored
Normal file
BIN
.yarn/cache/unorm-npm-1.6.0-43467eccf1-9a86546256.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/util-deprecate-npm-1.0.2-e3fe1a219c-474acf1146.zip
vendored
Normal file
BIN
.yarn/cache/util-deprecate-npm-1.0.2-e3fe1a219c-474acf1146.zip
vendored
Normal file
Binary file not shown.
@ -10,6 +10,7 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@keplr-wallet/types": "^0.11.23",
|
||||
"crypto": "^1.0.1",
|
||||
"iron-session": "^6.3.1",
|
||||
"next": "13.0.5",
|
||||
|
2
wallets/index.ts
Normal file
2
wallets/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./types";
|
||||
export * from "./keplr";
|
98
wallets/keplr.ts
Normal file
98
wallets/keplr.ts
Normal file
@ -0,0 +1,98 @@
|
||||
import {
|
||||
AminoSignResponse,
|
||||
BroadcastMode,
|
||||
ChainInfo,
|
||||
Keplr,
|
||||
StdSignDoc,
|
||||
} from "@keplr-wallet/types";
|
||||
import { Wallet } from "./types";
|
||||
|
||||
export const getKeplrFromWindow: () => Promise<
|
||||
Keplr | undefined
|
||||
> = async () => {
|
||||
if (typeof window === "undefined") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (window.keplr) {
|
||||
return window.keplr;
|
||||
}
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
return window.keplr;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const documentStateChange = (event: Event) => {
|
||||
if (
|
||||
event.target &&
|
||||
(event.target as Document).readyState === "complete"
|
||||
) {
|
||||
resolve(window.keplr);
|
||||
document.removeEventListener("readystatechange", documentStateChange);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("readystatechange", documentStateChange);
|
||||
});
|
||||
};
|
||||
|
||||
export class KeplrWallet implements Wallet {
|
||||
constructor(public readonly keplr: Keplr) {}
|
||||
|
||||
broadcastTxSync(chainId: string, tx: Uint8Array): Promise<Uint8Array> {
|
||||
return this.keplr.sendTx(chainId, tx, BroadcastMode.Sync);
|
||||
}
|
||||
|
||||
getChainInfosWithoutEndpoints(): Promise<
|
||||
Omit<ChainInfo, "rest" | "rpc" | "nodeProvider">[]
|
||||
> {
|
||||
// TODO: Update @keplr-wallet/types
|
||||
return (this.keplr as any).getChainInfosWithoutEndpoints();
|
||||
}
|
||||
|
||||
getKey(chainId: string): Promise<{
|
||||
readonly name: string;
|
||||
readonly pubKey: Uint8Array;
|
||||
readonly address: Uint8Array;
|
||||
}> {
|
||||
return this.keplr.getKey(chainId);
|
||||
}
|
||||
|
||||
init(chainIds: string[]): Promise<void> {
|
||||
return this.keplr.enable(chainIds);
|
||||
}
|
||||
|
||||
signAmino(
|
||||
chainId: string,
|
||||
signer: string,
|
||||
signDoc: StdSignDoc,
|
||||
): Promise<AminoSignResponse> {
|
||||
return this.keplr.signAmino(chainId, signer, signDoc);
|
||||
}
|
||||
|
||||
signICNSAdr36(
|
||||
chainId: string,
|
||||
contractAddress: string,
|
||||
owner: string,
|
||||
username: string,
|
||||
addressChainIds: string[],
|
||||
): Promise<{
|
||||
chainId: string;
|
||||
bech32Prefix: string;
|
||||
bech32Address: string;
|
||||
addressHash: "cosmos" | "ethereum";
|
||||
pubKey: Uint8Array;
|
||||
signatureSalt: number;
|
||||
signature: Uint8Array;
|
||||
}> {
|
||||
// TODO: Update @keplr-wallet/types
|
||||
return (this.keplr as any).signICNSAdr36(
|
||||
chainId,
|
||||
contractAddress,
|
||||
owner,
|
||||
username,
|
||||
addressChainIds,
|
||||
);
|
||||
}
|
||||
}
|
37
wallets/types.ts
Normal file
37
wallets/types.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { AminoSignResponse, ChainInfo, StdSignDoc } from "@keplr-wallet/types";
|
||||
|
||||
export interface Wallet {
|
||||
init(chainIds: string[]): Promise<void>;
|
||||
|
||||
getChainInfosWithoutEndpoints(): Promise<
|
||||
Omit<ChainInfo, "rest" | "rpc" | "nodeProvider">[]
|
||||
>;
|
||||
|
||||
getKey(chainId: string): Promise<{
|
||||
readonly name: string;
|
||||
readonly pubKey: Uint8Array;
|
||||
readonly address: Uint8Array;
|
||||
}>;
|
||||
signAmino(
|
||||
chainId: string,
|
||||
signer: string,
|
||||
signDoc: StdSignDoc,
|
||||
): Promise<AminoSignResponse>;
|
||||
broadcastTxSync(chainId: string, tx: Uint8Array): Promise<Uint8Array>;
|
||||
|
||||
signICNSAdr36(
|
||||
chainId: string,
|
||||
contractAddress: string,
|
||||
owner: string,
|
||||
username: string,
|
||||
addressChainIds: string[],
|
||||
): Promise<{
|
||||
chainId: string;
|
||||
bech32Prefix: string;
|
||||
bech32Address: string;
|
||||
addressHash: "cosmos" | "ethereum";
|
||||
pubKey: Uint8Array;
|
||||
signatureSalt: number;
|
||||
signature: Uint8Array;
|
||||
}>;
|
||||
}
|
6
window.d.ts
vendored
Normal file
6
window.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { Window as KeplrWindow } from "@keplr-wallet/types";
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface Window extends KeplrWindow {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user