@hashgraph/hedera-wallet-connect 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ import type { Signer } from '@hashgraph/sdk';
2
+ import { AccountBalance, AccountId, AccountInfo, Executable, Key, LedgerId, SignerSignature, Transaction, TransactionRecord } from "@hashgraph/sdk";
3
+ import { ISignClient } from "@walletconnect/types";
4
+ /**
5
+ * Implements Hedera Signer interface.
6
+ * https://hips.hedera.com/hip/hip-338
7
+ */
8
+ export declare class WCSigner implements Signer {
9
+ private readonly accountId;
10
+ private readonly client;
11
+ private readonly topic;
12
+ private readonly ledgerId;
13
+ private extensionMethods;
14
+ constructor(accountId: AccountId, client: ISignClient, topic: string, ledgerId?: LedgerId, extensionMethods?: string[]);
15
+ private wrappedRequest;
16
+ getAccountId(): AccountId;
17
+ getAccountKey(): Promise<Key>;
18
+ getLedgerId(): LedgerId;
19
+ getNetwork(): Promise<{
20
+ [key: string]: (string | AccountId);
21
+ }>;
22
+ getMirrorNetwork(): Promise<string[]>;
23
+ sign(messages: Uint8Array[], signOptions?: Record<string, any>): Promise<SignerSignature[]>;
24
+ private extensionMethodCall;
25
+ getAccountBalance(): Promise<AccountBalance>;
26
+ getAccountInfo(): Promise<AccountInfo>;
27
+ getAccountRecords(): Promise<TransactionRecord[]>;
28
+ signTransaction<T extends Transaction>(transaction: T): Promise<T>;
29
+ checkTransaction<T extends Transaction>(transaction: T): Promise<T>;
30
+ populateTransaction<T extends Transaction>(transaction: T): Promise<T>;
31
+ call<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>): Promise<OutputT>;
32
+ }
33
+ //# sourceMappingURL=WCSigner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WCSigner.d.ts","sourceRoot":"","sources":["../../../src/WCSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,SAAS,EACT,WAAW,EACX,UA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AAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiCnE,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAYtE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAgC9G"}
@@ -0,0 +1,21 @@
1
+ import { Signer } from "@hashgraph/sdk";
2
+ import { EngineTypes, PairingTypes, SessionTypes, SignClientTypes } from "@walletconnect/types";
3
+ import { Connector } from "./Connector.js";
4
+ import ApproveParams = EngineTypes.ApproveParams;
5
+ import RejectParams = EngineTypes.RejectParams;
6
+ type ProposalCallback = (proposal: SignClientTypes.EventArguments["session_proposal"]) => Promise<void>;
7
+ export declare class WalletConnector extends Connector {
8
+ onProposalReceive: ProposalCallback;
9
+ constructor(metadata?: SignClientTypes.Metadata);
10
+ init(onProposalReceive: ProposalCallback): Promise<void>;
11
+ pair(uri: string): Promise<PairingTypes.Struct>;
12
+ private subscribeToEvents;
13
+ private destroySession;
14
+ private onSessionRequest;
15
+ private onSessionProposal;
16
+ approveSessionProposal<T extends Signer>(data: ApproveParams, signers: T[]): Promise<SessionTypes.Struct>;
17
+ rejectSessionProposal(data: RejectParams): Promise<void>;
18
+ sendEvent(name: string, data: any): Promise<void>;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=WalletConnector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WalletConnector.d.ts","sourceRoot":"","sources":["../../../src/WalletConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAA+B,MAAM,gBAAgB,CAAC;AAG3E,OAAO,EAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;AACjD,OAAO,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC;AAG/C,KAAK,gBAAgB,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,kBAAkB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExG,qBAAa,eAAgB,SAAQ,SAAS;IACrC,iBAAiB,EAAE,gBAAgB,CAAC;gBAE/B,QAAQ,CAAC,EAAE,eAAe,CAAC,QAAQ;IAIlC,IAAI,CAAC,iBAAiB,EAAE,gBAAgB;IAgBxC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAQ5D,OAAO,CAAC,iBAAiB;YAUX,cAAc;YAId,gBAAgB;YA2HhB,iBAAiB;IAIlB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAkBzG,qBAAqB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAa/D"}
@@ -0,0 +1,4 @@
1
+ export * from "./DAppConnector.js";
2
+ export * from "./WalletConnector.js";
3
+ export * from "./Utils.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAA"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@hashgraph/hedera-wallet-connect",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./lib/esm/types/index.d.ts",
8
+ "import": "./lib/esm/index.js"
9
+ }
10
+ },
11
+ "types": "./lib/esm/types/index.d.ts",
12
+ "main": "./lib/esm/index.js",
13
+ "author": "Blade Labs",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/hashgraph/hedera-wallet-connect"
18
+ },
19
+ "scripts": {
20
+ "clean": "rimraf lib",
21
+ "build": "npm run clean && npm run build:esm",
22
+ "build:esm": "tsc",
23
+ "prepack": "npm run build"
24
+ },
25
+ "dependencies": {
26
+ "@json-rpc-tools/utils": "^2.0.0-beta.12",
27
+ "@hashgraph/sdk": "^2.19.1",
28
+ "@walletconnect/core": "^2.1.3",
29
+ "@walletconnect/types": "^2.1.3",
30
+ "@walletconnect/sign-client": "^2.1.3",
31
+ "@walletconnect/qrcode-modal": "^2.0.0-alpha.20",
32
+ "buffer": "^6.0.3",
33
+ "events": "^3.3.0",
34
+ "rxjs": "^7.5.7"
35
+ },
36
+ "devDependencies": {
37
+ "rimraf": "^3.0.2",
38
+ "typescript": "^4.9.3",
39
+ "tslint": "^6.1.3"
40
+ }
41
+ }