@hashgraph/hedera-wallet-connect 1.3.8-canary.afbe057.0 → 1.3.8-canary.e37de31.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/{dapp → lib/dapp}/DAppSigner.d.ts +3 -1
- package/dist/{dapp → lib/dapp}/DAppSigner.js +8 -4
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +22 -0
- package/dist/{shared → lib/shared}/utils.d.ts +6 -0
- package/dist/{shared → lib/shared}/utils.js +8 -0
- package/package.json +4 -3
- /package/dist/{dapp → lib/dapp}/index.d.ts +0 -0
- /package/dist/{dapp → lib/dapp}/index.js +0 -0
- /package/dist/{shared → lib/shared}/chainIds.d.ts +0 -0
- /package/dist/{shared → lib/shared}/chainIds.js +0 -0
- /package/dist/{shared → lib/shared}/errors.d.ts +0 -0
- /package/dist/{shared → lib/shared}/errors.js +0 -0
- /package/dist/{shared → lib/shared}/events.d.ts +0 -0
- /package/dist/{shared → lib/shared}/events.js +0 -0
- /package/dist/{shared → lib/shared}/extensionController.d.ts +0 -0
- /package/dist/{shared → lib/shared}/extensionController.js +0 -0
- /package/dist/{shared → lib/shared}/index.d.ts +0 -0
- /package/dist/{shared → lib/shared}/index.js +0 -0
- /package/dist/{shared → lib/shared}/logger.d.ts +0 -0
- /package/dist/{shared → lib/shared}/logger.js +0 -0
- /package/dist/{shared → lib/shared}/methods.d.ts +0 -0
- /package/dist/{shared → lib/shared}/methods.js +0 -0
- /package/dist/{shared → lib/shared}/payloads.d.ts +0 -0
- /package/dist/{shared → lib/shared}/payloads.js +0 -0
- /package/dist/{wallet → lib/wallet}/index.d.ts +0 -0
- /package/dist/{wallet → lib/wallet}/index.js +0 -0
- /package/dist/{wallet → lib/wallet}/provider.d.ts +0 -0
- /package/dist/{wallet → lib/wallet}/provider.js +0 -0
- /package/dist/{wallet → lib/wallet}/types.d.ts +0 -0
- /package/dist/{wallet → lib/wallet}/types.js +0 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -31,7 +31,9 @@ export declare class DAppSigner implements Signer {
|
|
31
31
|
getAccountInfo(): Promise<AccountInfo>;
|
32
32
|
getAccountRecords(): Promise<TransactionRecord[]>;
|
33
33
|
getMetadata(): CoreTypes.Metadata;
|
34
|
-
sign(data: Uint8Array[], signOptions?:
|
34
|
+
sign(data: Uint8Array[], signOptions?: {
|
35
|
+
encoding?: 'utf-8' | 'base64';
|
36
|
+
}): Promise<SignerSignature[]>;
|
35
37
|
checkTransaction<T extends Transaction>(transaction: T): Promise<T>;
|
36
38
|
populateTransaction<T extends Transaction>(transaction: T): Promise<T>;
|
37
39
|
/**
|
@@ -19,7 +19,7 @@
|
|
19
19
|
*/
|
20
20
|
import { AccountBalance, AccountId, AccountInfo, LedgerId, SignerSignature, Transaction, TransactionRecord, Client, PublicKey, TransactionId, TransactionResponse, Query, AccountRecordsQuery, AccountInfoQuery, AccountBalanceQuery, TransactionReceiptQuery, TransactionReceipt, TransactionRecordQuery, } from '@hashgraph/sdk';
|
21
21
|
import { proto } from '@hashgraph/proto';
|
22
|
-
import { HederaJsonRpcMethod,
|
22
|
+
import { HederaJsonRpcMethod, base64StringToSignatureMap, base64StringToUint8Array, ledgerIdToCAIPChainId, queryToBase64String, transactionBodyToBase64String, transactionToBase64String, transactionToTransactionBody, extensionOpen, Uint8ArrayToBase64String, Uint8ArrayToString, } from '../shared';
|
23
23
|
import { DefaultLogger } from '../shared/logger';
|
24
24
|
const clients = {};
|
25
25
|
export class DAppSigner {
|
@@ -95,14 +95,18 @@ export class DAppSigner {
|
|
95
95
|
getMetadata() {
|
96
96
|
return this.signClient.metadata;
|
97
97
|
}
|
98
|
-
async sign(data, signOptions
|
99
|
-
|
98
|
+
async sign(data, signOptions = {
|
99
|
+
encoding: 'utf-8',
|
100
|
+
}) {
|
100
101
|
try {
|
102
|
+
const messageToSign = signOptions.encoding === 'base64'
|
103
|
+
? Uint8ArrayToBase64String(data[0])
|
104
|
+
: Uint8ArrayToString(data[0]);
|
101
105
|
const { signatureMap } = await this.request({
|
102
106
|
method: HederaJsonRpcMethod.SignMessage,
|
103
107
|
params: {
|
104
108
|
signerAccountId: this._signerAccountId,
|
105
|
-
message:
|
109
|
+
message: messageToSign,
|
106
110
|
},
|
107
111
|
});
|
108
112
|
const sigmap = base64StringToSignatureMap(signatureMap);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Hedera Wallet Connect
|
4
|
+
*
|
5
|
+
* Copyright (C) 2023 Hedera Hashgraph, LLC
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
*
|
19
|
+
*/
|
20
|
+
export * from './shared';
|
21
|
+
export { default as Wallet } from './wallet';
|
22
|
+
export * from './dapp';
|
@@ -85,6 +85,12 @@ export declare function base64StringToSignatureMap(base64string: string): proto.
|
|
85
85
|
* @returns Base64-encoded string representation of the input `Uint8Array`
|
86
86
|
*/
|
87
87
|
export declare function Uint8ArrayToBase64String(binary: Uint8Array): string;
|
88
|
+
/**
|
89
|
+
* Encodes the binary data represented by the `Uint8Array` to a UTF-8 string.
|
90
|
+
* @param binary - The `Uint8Array` containing binary data to be converted
|
91
|
+
* @returns UTF-8 string representation of the input `Uint8Array`
|
92
|
+
*/
|
93
|
+
export declare function Uint8ArrayToString(binary: Uint8Array): string;
|
88
94
|
/**
|
89
95
|
* Converts a Base64-encoded string to a `Uint8Array`.
|
90
96
|
* @param base64string - Base64-encoded string to be converted
|
@@ -139,6 +139,14 @@ export function base64StringToSignatureMap(base64string) {
|
|
139
139
|
export function Uint8ArrayToBase64String(binary) {
|
140
140
|
return Buffer.from(binary).toString('base64');
|
141
141
|
}
|
142
|
+
/**
|
143
|
+
* Encodes the binary data represented by the `Uint8Array` to a UTF-8 string.
|
144
|
+
* @param binary - The `Uint8Array` containing binary data to be converted
|
145
|
+
* @returns UTF-8 string representation of the input `Uint8Array`
|
146
|
+
*/
|
147
|
+
export function Uint8ArrayToString(binary) {
|
148
|
+
return Buffer.from(binary).toString('utf-8');
|
149
|
+
}
|
142
150
|
/**
|
143
151
|
* Converts a Base64-encoded string to a `Uint8Array`.
|
144
152
|
* @param base64string - Base64-encoded string to be converted
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hashgraph/hedera-wallet-connect",
|
3
|
-
"version": "1.3.8-canary.
|
3
|
+
"version": "1.3.8-canary.e37de31.0",
|
4
4
|
"description": "A library to facilitate integrating Hedera with WalletConnect",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "git+https://github.com/hashgraph/hedera-wallet-connect.git"
|
8
8
|
},
|
9
|
-
"main": "./dist/
|
10
|
-
"types": "./dist/
|
9
|
+
"main": "./dist/index.js",
|
10
|
+
"types": "./dist/index.d.ts",
|
11
11
|
"author": "Hgraph <support@hgraph.io>",
|
12
12
|
"keywords": [
|
13
13
|
"hedera",
|
@@ -55,6 +55,7 @@
|
|
55
55
|
"dev:ts-demo": "rimraf dist && npm run build && concurrently --raw \"npm run watch\" \"node scripts/demos/typescript/dev.mjs\"",
|
56
56
|
"dev:react-demo": "rimraf dist && npm run build && concurrently --raw \"npm run watch\" \"node scripts/demos/react/dev.mjs\"",
|
57
57
|
"test": "jest",
|
58
|
+
"test:watch": "jest --watch",
|
58
59
|
"test:connect": "jest --testMatch '**/DAppConnector.test.ts' --verbose",
|
59
60
|
"test:signer": "jest --testMatch '**/DAppSigner.test.ts' --verbose",
|
60
61
|
"prepublishOnly": "rm -Rf dist && npm run build",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|