@hashgraph/hedera-wallet-connect 1.3.2-0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +20 -0
- package/dist/{types/src → src}/lib/dapp/DAppSigner.d.ts +0 -1
- package/dist/src/lib/dapp/DAppSigner.js +214 -0
- package/dist/{types/src → src}/lib/dapp/index.d.ts +0 -1
- package/dist/src/lib/dapp/index.js +431 -0
- package/dist/{types/src → src}/lib/index.d.ts +0 -1
- package/dist/src/lib/index.js +22 -0
- package/dist/{types/src → src}/lib/shared/chainIds.d.ts +0 -1
- package/dist/src/lib/shared/chainIds.js +31 -0
- package/dist/{types/src → src}/lib/shared/errors.d.ts +0 -1
- package/dist/src/lib/shared/errors.js +51 -0
- package/dist/{types/src → src}/lib/shared/events.d.ts +0 -1
- package/dist/src/lib/shared/events.js +27 -0
- package/dist/{types/src → src}/lib/shared/extensionController.d.ts +0 -1
- package/dist/src/lib/shared/extensionController.js +42 -0
- package/dist/{types/src → src}/lib/shared/index.d.ts +0 -1
- package/dist/src/lib/shared/index.js +26 -0
- package/dist/{types/src → src}/lib/shared/methods.d.ts +0 -1
- package/dist/src/lib/shared/methods.js +32 -0
- package/dist/{types/src → src}/lib/shared/payloads.d.ts +0 -1
- package/dist/src/lib/shared/payloads.js +20 -0
- package/dist/{types/src → src}/lib/shared/utils.d.ts +0 -1
- package/dist/src/lib/shared/utils.js +424 -0
- package/dist/{types/src → src}/lib/wallet/index.d.ts +0 -1
- package/dist/src/lib/wallet/index.js +301 -0
- package/dist/{types/src → src}/lib/wallet/provider.d.ts +0 -1
- package/dist/src/lib/wallet/provider.js +58 -0
- package/dist/{types/src → src}/lib/wallet/types.d.ts +0 -1
- package/dist/src/lib/wallet/types.js +20 -0
- package/dist/{types/test → test}/_helpers.d.ts +0 -1
- package/dist/test/_helpers.js +95 -0
- package/dist/test/dapp/DAppConnector.test.d.ts +1 -0
- package/dist/test/dapp/DAppConnector.test.js +236 -0
- package/dist/test/dapp/DAppSigner.test.d.ts +1 -0
- package/dist/test/dapp/DAppSigner.test.js +155 -0
- package/dist/test/utils.test.d.ts +1 -0
- package/dist/test/utils.test.js +202 -0
- package/dist/test/wallet/methods/wallet-executeTransaction.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-executeTransaction.test.js +43 -0
- package/dist/test/wallet/methods/wallet-getNodeAddresses.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-getNodeAddresses.test.js +40 -0
- package/dist/test/wallet/methods/wallet-signAndExecuteQuery.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-signAndExecuteQuery.test.js +41 -0
- package/dist/test/wallet/methods/wallet-signAndExecuteTransaction.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-signAndExecuteTransaction.test.js +48 -0
- package/dist/test/wallet/methods/wallet-signMessage.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-signMessage.test.js +60 -0
- package/dist/test/wallet/methods/wallet-signTransaction.test.d.ts +1 -0
- package/dist/test/wallet/methods/wallet-signTransaction.test.js +45 -0
- package/dist/test/wallet/wallet-init.test.d.ts +1 -0
- package/dist/test/wallet/wallet-init.test.js +53 -0
- package/package.json +11 -19
- package/dist/browser-cjs-metafile.json +0 -1
- package/dist/browser-cjs.js +0 -250
- package/dist/browser-esm-metafile.json +0 -1
- package/dist/browser-esm.js +0 -250
- package/dist/node-cjs-metafile.json +0 -1
- package/dist/node-cjs.js +0 -11404
- package/dist/node-esm-metafile.json +0 -1
- package/dist/node-esm.js +0 -11404
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +0 -1
- package/dist/types/src/lib/dapp/DAppSigner.d.ts.map +0 -1
- package/dist/types/src/lib/dapp/index.d.ts.map +0 -1
- package/dist/types/src/lib/index.d.ts.map +0 -1
- package/dist/types/src/lib/shared/chainIds.d.ts.map +0 -1
- package/dist/types/src/lib/shared/errors.d.ts.map +0 -1
- package/dist/types/src/lib/shared/events.d.ts.map +0 -1
- package/dist/types/src/lib/shared/extensionController.d.ts.map +0 -1
- package/dist/types/src/lib/shared/index.d.ts.map +0 -1
- package/dist/types/src/lib/shared/methods.d.ts.map +0 -1
- package/dist/types/src/lib/shared/payloads.d.ts.map +0 -1
- package/dist/types/src/lib/shared/utils.d.ts.map +0 -1
- package/dist/types/src/lib/wallet/index.d.ts.map +0 -1
- package/dist/types/src/lib/wallet/provider.d.ts.map +0 -1
- package/dist/types/src/lib/wallet/types.d.ts.map +0 -1
- package/dist/types/test/_helpers.d.ts.map +0 -1
- package/dist/types/test/dapp/DAppConnector.test.d.ts +0 -2
- package/dist/types/test/dapp/DAppConnector.test.d.ts.map +0 -1
- package/dist/types/test/dapp/DAppSigner.test.d.ts +0 -2
- package/dist/types/test/dapp/DAppSigner.test.d.ts.map +0 -1
- package/dist/types/test/utils.test.d.ts +0 -2
- package/dist/types/test/utils.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-executeTransaction.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-executeTransaction.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-getNodeAddresses.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-getNodeAddresses.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-signAndExecuteQuery.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-signAndExecuteQuery.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-signAndExecuteTransaction.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-signAndExecuteTransaction.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-signMessage.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-signMessage.test.d.ts.map +0 -1
- package/dist/types/test/wallet/methods/wallet-signTransaction.test.d.ts +0 -2
- package/dist/types/test/wallet/methods/wallet-signTransaction.test.d.ts.map +0 -1
- package/dist/types/test/wallet/wallet-init.test.d.ts +0 -2
- package/dist/types/test/wallet/wallet-init.test.d.ts.map +0 -1
@@ -0,0 +1,40 @@
|
|
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
|
+
import { HederaChainId, Wallet } from '../../../src';
|
21
|
+
import { projectId, requestId, requestTopic, testPrivateKeyECDSA, testUserAccountId, useJsonFixture, walletMetadata, } from '../../_helpers';
|
22
|
+
describe(Wallet.name, () => {
|
23
|
+
describe('getNodeAddresses', () => {
|
24
|
+
it('should return array of nodes addresses', async () => {
|
25
|
+
const wallet = await Wallet.create(projectId, walletMetadata);
|
26
|
+
const hederaWallet = wallet.getHederaWallet(HederaChainId.Testnet, testUserAccountId.toString(), testPrivateKeyECDSA);
|
27
|
+
const respondSessionRequestSpy = jest.spyOn(wallet, 'respondSessionRequest');
|
28
|
+
try {
|
29
|
+
await wallet.hedera_getNodeAddresses(requestId, requestTopic, null, hederaWallet);
|
30
|
+
}
|
31
|
+
catch (err) { }
|
32
|
+
const mockResponse = useJsonFixture('methods/getNodeAddressesSuccess');
|
33
|
+
const callArguments = respondSessionRequestSpy.mock.calls[0][0];
|
34
|
+
const response = callArguments;
|
35
|
+
response.response.result.nodes.sort();
|
36
|
+
mockResponse.response.result.nodes.sort();
|
37
|
+
expect(response).toEqual(mockResponse);
|
38
|
+
}, 15000);
|
39
|
+
});
|
40
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,41 @@
|
|
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
|
+
import { AccountInfoQuery } from '@hashgraph/sdk';
|
21
|
+
import { HederaChainId, Wallet, base64StringToUint8Array, } from '../../../src';
|
22
|
+
import { projectId, requestId, requestTopic, testPrivateKeyECDSA, testUserAccountId, useJsonFixture, walletMetadata, } from '../../_helpers';
|
23
|
+
describe(Wallet.name, () => {
|
24
|
+
describe('signAndExecuteQuery', () => {
|
25
|
+
it('should sign and execute query, returning the query response', async () => {
|
26
|
+
const wallet = await Wallet.create(projectId, walletMetadata);
|
27
|
+
const hederaWallet = wallet.getHederaWallet(HederaChainId.Testnet, testUserAccountId.toString(), testPrivateKeyECDSA);
|
28
|
+
const query = new AccountInfoQuery().setAccountId(testUserAccountId);
|
29
|
+
const respondSessionRequestSpy = jest.spyOn(wallet, 'respondSessionRequest');
|
30
|
+
const signerCallMock = jest.spyOn(query, 'executeWithSigner');
|
31
|
+
const toBytes = () => base64StringToUint8Array(btoa('Hello World!'));
|
32
|
+
signerCallMock.mockImplementation(async () => ({ toBytes }));
|
33
|
+
try {
|
34
|
+
await wallet.hedera_signAndExecuteQuery(requestId, requestTopic, query, hederaWallet);
|
35
|
+
}
|
36
|
+
catch (err) { }
|
37
|
+
const mockResponse = useJsonFixture('methods/signAndExecuteQuerySuccess');
|
38
|
+
expect(respondSessionRequestSpy).toHaveBeenCalledWith(mockResponse);
|
39
|
+
}, 15000);
|
40
|
+
});
|
41
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,48 @@
|
|
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
|
+
import { TopicCreateTransaction } from '@hashgraph/sdk';
|
21
|
+
import { HederaChainId, Wallet } from '../../../src';
|
22
|
+
import { prepareTestTransaction, projectId, requestId, requestTopic, testPrivateKeyECDSA, testUserAccountId, useJsonFixture, walletMetadata, } from '../../_helpers';
|
23
|
+
describe(Wallet.name, () => {
|
24
|
+
describe('signAndExecuteTransaction', () => {
|
25
|
+
it('should sign and execute, returning the transaction response', async () => {
|
26
|
+
try {
|
27
|
+
const wallet = await Wallet.create(projectId, walletMetadata);
|
28
|
+
const hederaWallet = wallet.getHederaWallet(HederaChainId.Testnet, testUserAccountId.toString(), testPrivateKeyECDSA);
|
29
|
+
const signerCallMock = jest.spyOn(hederaWallet, 'call');
|
30
|
+
signerCallMock.mockImplementation(async () => {
|
31
|
+
return {
|
32
|
+
nodeId: '0.0.3',
|
33
|
+
transactionHash: 'uO6obRah/zbL1Wn1ZVd5unos7kbsI8G5bHifKGVWUGZPiCafQzr/hdlEJyUiKLw9',
|
34
|
+
transactionId: '0.0.12345@1691705630.325343432',
|
35
|
+
};
|
36
|
+
}); // Mocking the 'call' method to do nothing
|
37
|
+
const transaction = prepareTestTransaction(new TopicCreateTransaction(), {
|
38
|
+
freeze: true,
|
39
|
+
});
|
40
|
+
const respondSessionRequestSpy = jest.spyOn(wallet, 'respondSessionRequest');
|
41
|
+
await wallet.hedera_signAndExecuteTransaction(requestId, requestTopic, transaction, hederaWallet);
|
42
|
+
const mockResponse = useJsonFixture('methods/signAndExecuteTransactionSuccess');
|
43
|
+
expect(respondSessionRequestSpy).toHaveBeenCalledWith(mockResponse);
|
44
|
+
}
|
45
|
+
catch (err) { }
|
46
|
+
}, 15000);
|
47
|
+
});
|
48
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,60 @@
|
|
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
|
+
import { HederaChainId, Wallet } from '../../../src';
|
21
|
+
import { testPrivateKeyECDSA, testPrivateKeyED25519, testUserAccountId, walletMetadata, projectId, } from '../../_helpers';
|
22
|
+
describe(Wallet.name, () => {
|
23
|
+
describe('signMessage', () => {
|
24
|
+
// [private key type, private key, expected value]
|
25
|
+
const testCases = [
|
26
|
+
[
|
27
|
+
'ECDSA',
|
28
|
+
testPrivateKeyECDSA,
|
29
|
+
'CmUKIQJ4J53yGuPNMGEGJ7HkI+u3QFxUuAOa9VLEtFj7Y6qNMzJAp3vxT7kRPE9HFFm/bbArGYDQ+psNWZC70rdW2bE1L86REC5xavtsalXfGaZ7FsdkWwPg4GBUKuzmr1eFTcYdNg==',
|
30
|
+
],
|
31
|
+
[
|
32
|
+
'ED25519',
|
33
|
+
testPrivateKeyED25519,
|
34
|
+
'CmQKIKLvE3YbZEplGhpKxmbq+6xBnJcoL4r1wz9Y1zLnPlpVGkBtfDTfBZGf/MUbovYyLUjORErDGhDYbzPFoAbkMwRrpw2ouDRmn6Dd6A06k6yM/FhZ/VjdHVhQUd+fxv1cZqUM',
|
35
|
+
],
|
36
|
+
];
|
37
|
+
test.each(testCases)('should decode message bytes and sign with: %p', async (_, privateKey, expected) => {
|
38
|
+
const wallet = await Wallet.create(projectId, walletMetadata);
|
39
|
+
const id = 1;
|
40
|
+
const topic = 'test-topic';
|
41
|
+
const hederaWallet = wallet.getHederaWallet(HederaChainId.Testnet, testUserAccountId.toString(), privateKey);
|
42
|
+
const respondSessionRequestSpy = jest.spyOn(wallet, 'respondSessionRequest');
|
43
|
+
try {
|
44
|
+
await wallet.hedera_signMessage(id, topic, 'Hello Future', hederaWallet);
|
45
|
+
}
|
46
|
+
catch (err) { }
|
47
|
+
const mockResponse = {
|
48
|
+
topic,
|
49
|
+
response: {
|
50
|
+
jsonrpc: '2.0',
|
51
|
+
id,
|
52
|
+
result: {
|
53
|
+
signatureMap: expected,
|
54
|
+
},
|
55
|
+
},
|
56
|
+
};
|
57
|
+
expect(respondSessionRequestSpy).toHaveBeenCalledWith(mockResponse);
|
58
|
+
});
|
59
|
+
});
|
60
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,45 @@
|
|
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
|
+
import { TransferTransaction, AccountId, Hbar } from '@hashgraph/sdk';
|
21
|
+
import { HederaChainId, Wallet, transactionToTransactionBody, } from '../../../src';
|
22
|
+
import { projectId, requestId, requestTopic, testPrivateKeyECDSA, testUserAccountId, useJsonFixture, walletMetadata, } from '../../_helpers';
|
23
|
+
describe(Wallet.name, () => {
|
24
|
+
describe('signTransaction', () => {
|
25
|
+
it('should sign a transaction and return without executing', async () => {
|
26
|
+
try {
|
27
|
+
const wallet = await Wallet.create(projectId, walletMetadata);
|
28
|
+
const hederaWallet = wallet.getHederaWallet(HederaChainId.Testnet, testUserAccountId.toString(), testPrivateKeyECDSA);
|
29
|
+
const transaction = new TransferTransaction()
|
30
|
+
.setMaxTransactionFee(new Hbar(1))
|
31
|
+
.addHbarTransfer('0.0.123', new Hbar(10))
|
32
|
+
.addHbarTransfer('0.0.321', new Hbar(-10));
|
33
|
+
const transactionBody = transactionToTransactionBody(transaction, AccountId.fromString('0.0.3'));
|
34
|
+
const respondSessionRequestSpy = jest.spyOn(wallet, 'respondSessionRequest');
|
35
|
+
const response = await wallet.hedera_signTransaction(requestId, requestTopic, transactionBody, hederaWallet);
|
36
|
+
console.log(response);
|
37
|
+
const mockResponse = useJsonFixture('methods/signTransactionSuccess');
|
38
|
+
mockResponse.response.result;
|
39
|
+
respondSessionRequestSpy;
|
40
|
+
expect(respondSessionRequestSpy).toHaveBeenCalledWith(mockResponse);
|
41
|
+
}
|
42
|
+
catch (err) { }
|
43
|
+
}, 15000);
|
44
|
+
});
|
45
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,53 @@
|
|
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
|
+
import { Wallet as HederaWallet, LedgerId } from '@hashgraph/sdk';
|
21
|
+
import { HederaChainId, Wallet } from '../../src';
|
22
|
+
import { defaultAccountNumber, projectId, testPrivateKeyECDSA, walletMetadata, } from '../_helpers';
|
23
|
+
describe(Wallet.name, () => {
|
24
|
+
describe('create', () => {
|
25
|
+
let wallet;
|
26
|
+
beforeAll(async () => {
|
27
|
+
wallet = await Wallet.create(projectId, walletMetadata);
|
28
|
+
});
|
29
|
+
it('should create Wallet instance with a projectId and walletMetadata', async () => {
|
30
|
+
expect(wallet).toBeInstanceOf(Wallet);
|
31
|
+
expect(wallet.metadata).toBe(walletMetadata);
|
32
|
+
expect(wallet.core.projectId).toBe(projectId);
|
33
|
+
});
|
34
|
+
describe('getHederaWallet', () => {
|
35
|
+
// [HederaChainId, accountId, LedgerId]
|
36
|
+
const testCases = [
|
37
|
+
[HederaChainId.Mainnet, defaultAccountNumber, LedgerId.MAINNET],
|
38
|
+
[HederaChainId.Previewnet, defaultAccountNumber, LedgerId.PREVIEWNET],
|
39
|
+
[HederaChainId.Testnet, defaultAccountNumber, LedgerId.TESTNET],
|
40
|
+
[HederaChainId.Mainnet, `0.0.${defaultAccountNumber}`, LedgerId.MAINNET],
|
41
|
+
[HederaChainId.Previewnet, `0.0.${defaultAccountNumber}`, LedgerId.PREVIEWNET],
|
42
|
+
[HederaChainId.Testnet, `0.0.${defaultAccountNumber}`, LedgerId.TESTNET],
|
43
|
+
];
|
44
|
+
test.each(testCases)('it should initialize HederaWallet with %p chainId and %p accountId', async (chainId, accountId, ledgerId) => {
|
45
|
+
const hederaWallet = wallet.getHederaWallet(chainId, accountId.toString(), testPrivateKeyECDSA);
|
46
|
+
expect(wallet).toBeInstanceOf(Wallet);
|
47
|
+
expect(hederaWallet).toBeInstanceOf(HederaWallet);
|
48
|
+
expect(hederaWallet.accountId.toString()).toBe(`0.0.${defaultAccountNumber}`);
|
49
|
+
expect(hederaWallet.provider.getLedgerId()).toBe(ledgerId);
|
50
|
+
});
|
51
|
+
});
|
52
|
+
});
|
53
|
+
});
|
package/package.json
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hashgraph/hedera-wallet-connect",
|
3
|
-
"version": "1.3.2
|
3
|
+
"version": "1.3.2",
|
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
|
-
"
|
11
|
-
"browser": {
|
12
|
-
"./dist/node-cjs.js": "./dist/browser-cjs.js",
|
13
|
-
"./dist/node-esm.js": "./dist/browser-esm.js"
|
14
|
-
},
|
15
|
-
"types": "./dist/types/src/index.d.ts",
|
9
|
+
"main": "./dist/src/index.js",
|
10
|
+
"types": "./dist/src/index.d.ts",
|
16
11
|
"author": "Hgraph <support@hgraph.io>",
|
17
12
|
"keywords": [
|
18
13
|
"hedera",
|
@@ -21,7 +16,7 @@
|
|
21
16
|
],
|
22
17
|
"license": "Apache-2.0",
|
23
18
|
"devDependencies": {
|
24
|
-
"@hashgraph/hedera-wallet-connect": "^1.
|
19
|
+
"@hashgraph/hedera-wallet-connect": "^1.3.1",
|
25
20
|
"@types/jest": "^29.5.3",
|
26
21
|
"@types/node": "^20.11.10",
|
27
22
|
"@types/react-dom": "^18.2.21",
|
@@ -29,7 +24,7 @@
|
|
29
24
|
"@walletconnect/sign-client": "^2.11.0",
|
30
25
|
"@walletconnect/types": "^2.11.0",
|
31
26
|
"concurrently": "^8.2.2",
|
32
|
-
"esbuild": "^0.
|
27
|
+
"esbuild": "^0.23.0",
|
33
28
|
"esbuild-plugin-copy": "^2.1.1",
|
34
29
|
"eslint-plugin-tsdoc": "^0.3.0",
|
35
30
|
"husky": "^9.0.6",
|
@@ -47,15 +42,8 @@
|
|
47
42
|
"typedoc-theme-hierarchy": "^4.1.2",
|
48
43
|
"typescript": "^5.2.2"
|
49
44
|
},
|
50
|
-
"dependencies": {
|
51
|
-
"@walletconnect/qrcode-modal": "^1.8.0",
|
52
|
-
"@walletconnect/types": "^2.11.0",
|
53
|
-
"@walletconnect/utils": "^2.11.0",
|
54
|
-
"@walletconnect/web3wallet": "^1.9.3"
|
55
|
-
},
|
56
45
|
"scripts": {
|
57
|
-
"build": "
|
58
|
-
"build:types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist/types",
|
46
|
+
"build": "rimraf dist && tsc",
|
59
47
|
"build:example": "node scripts/examples/build.mjs",
|
60
48
|
"build:demos": "node scripts/demos/build.mjs",
|
61
49
|
"build:docs": "typedoc --options typedoc.json",
|
@@ -72,6 +60,10 @@
|
|
72
60
|
"test:sigMap": "jest --testMatch '**/SignatureMapHelpers.test.ts' --verbose"
|
73
61
|
},
|
74
62
|
"peerDependencies": {
|
75
|
-
"@hashgraph/sdk": "^2.40.0"
|
63
|
+
"@hashgraph/sdk": "^2.40.0",
|
64
|
+
"@walletconnect/qrcode-modal": "^1.8.0",
|
65
|
+
"@walletconnect/types": "^2.11.0",
|
66
|
+
"@walletconnect/utils": "^2.11.0",
|
67
|
+
"@walletconnect/web3wallet": "^1.9.3"
|
76
68
|
}
|
77
69
|
}
|