@cardano-sdk/e2e 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/CHANGELOG.md +15 -0
- package/README.md +27 -0
- package/dist/cjs/factories.d.ts.map +1 -1
- package/dist/cjs/factories.js +1 -0
- package/dist/cjs/factories.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/factories.d.ts.map +1 -1
- package/dist/esm/factories.js +2 -1
- package/dist/esm/factories.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/env/.env.blockfrost +6 -0
- package/package.json +31 -31
- package/src/factories.ts +3 -1
- package/test/blockfrost/getAsset.test.ts +22 -0
- package/test/blockfrost/queryTransactions.test.ts +314 -0
- package/test/web-extension/extension/background/cip30.ts +3 -2
- package/test/web-extension/webpack.config.base.js +5 -0
- package/test/blockfrost/StakePoolCompare.test.ts +0 -377
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "End to end tests for the cardano-js-sdk packages.",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
"repository": "https://github.com/input-output-hk/cardano-js-sdk",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"./test/web-extension/extension/**/*.ts"
|
|
9
|
+
],
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": "./dist/esm/index.js",
|
|
13
13
|
"require": "./dist/cjs/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
],
|
|
16
|
+
"main": "dist/cjs/index.js",
|
|
17
|
+
"module": "dist/esm/index.js",
|
|
19
18
|
"scripts": {
|
|
20
19
|
"artillery:stake-pool-query": "WORKERS=1 node -r ts-node/register ../../node_modules/.bin/artillery run test/artillery/StakePoolSearch.yml",
|
|
21
20
|
"artillery:wallet-restoration": "WORKERS=1 node -r ts-node/register ../../node_modules/.bin/artillery run --dotenv ./.env test/artillery/wallet-restoration/WalletRestoration.yml",
|
|
@@ -73,28 +72,23 @@
|
|
|
73
72
|
"wait-for-network-epoch-3": "DB_SYNC_CONNECTION_STRING='postgresql://postgres:doNoUseThisSecret!@localhost:5435/cexplorer' ts-node src/scripts/is-local-network-ready.ts",
|
|
74
73
|
"wait-for-network-init": "local-network/scripts/wait-local-network-init.sh"
|
|
75
74
|
},
|
|
76
|
-
"repository": "https://github.com/input-output-hk/cardano-js-sdk",
|
|
77
|
-
"license": "Apache-2.0",
|
|
78
|
-
"publishConfig": {
|
|
79
|
-
"access": "public"
|
|
80
|
-
},
|
|
81
75
|
"dependencies": {
|
|
82
76
|
"@cardano-foundation/ledgerjs-hw-app-cardano": "^7.1.2",
|
|
83
77
|
"@cardano-ogmios/client": "6.5.0",
|
|
84
|
-
"@cardano-sdk/cardano-services": "~0.29.
|
|
85
|
-
"@cardano-sdk/cardano-services-client": "~0.20.
|
|
86
|
-
"@cardano-sdk/core": "~0.39.
|
|
78
|
+
"@cardano-sdk/cardano-services": "~0.29.9",
|
|
79
|
+
"@cardano-sdk/cardano-services-client": "~0.20.6",
|
|
80
|
+
"@cardano-sdk/core": "~0.39.2",
|
|
87
81
|
"@cardano-sdk/crypto": "~0.1.30",
|
|
88
|
-
"@cardano-sdk/hardware-ledger": "~0.12.
|
|
89
|
-
"@cardano-sdk/hardware-trezor": "~0.6.
|
|
90
|
-
"@cardano-sdk/input-selection": "~0.13.
|
|
91
|
-
"@cardano-sdk/key-management": "~0.24.
|
|
92
|
-
"@cardano-sdk/ogmios": "~0.17.
|
|
93
|
-
"@cardano-sdk/tx-construction": "~0.21.
|
|
82
|
+
"@cardano-sdk/hardware-ledger": "~0.12.1",
|
|
83
|
+
"@cardano-sdk/hardware-trezor": "~0.6.1",
|
|
84
|
+
"@cardano-sdk/input-selection": "~0.13.17",
|
|
85
|
+
"@cardano-sdk/key-management": "~0.24.1",
|
|
86
|
+
"@cardano-sdk/ogmios": "~0.17.6",
|
|
87
|
+
"@cardano-sdk/tx-construction": "~0.21.2",
|
|
94
88
|
"@cardano-sdk/util": "~0.15.5",
|
|
95
|
-
"@cardano-sdk/util-dev": "~0.22.
|
|
96
|
-
"@cardano-sdk/util-rxjs": "~0.7.
|
|
97
|
-
"@cardano-sdk/wallet": "~0.
|
|
89
|
+
"@cardano-sdk/util-dev": "~0.22.8",
|
|
90
|
+
"@cardano-sdk/util-rxjs": "~0.7.30",
|
|
91
|
+
"@cardano-sdk/wallet": "~0.44.0",
|
|
98
92
|
"@dcspark/cardano-multiplatform-lib-nodejs": "^3.1.1",
|
|
99
93
|
"@shiroyasha9/axios-fetch-adapter": "1.0.3",
|
|
100
94
|
"axios": "^1.7.4",
|
|
@@ -124,10 +118,10 @@
|
|
|
124
118
|
"@babel/core": "^7.18.2",
|
|
125
119
|
"@babel/preset-env": "^7.18.2",
|
|
126
120
|
"@babel/preset-typescript": "^7.17.12",
|
|
127
|
-
"@cardano-sdk/dapp-connector": "~0.12.
|
|
128
|
-
"@cardano-sdk/projection": "~0.11.
|
|
129
|
-
"@cardano-sdk/projection-typeorm": "~0.8.
|
|
130
|
-
"@cardano-sdk/web-extension": "~0.
|
|
121
|
+
"@cardano-sdk/dapp-connector": "~0.12.35",
|
|
122
|
+
"@cardano-sdk/projection": "~0.11.34",
|
|
123
|
+
"@cardano-sdk/projection-typeorm": "~0.8.36",
|
|
124
|
+
"@cardano-sdk/web-extension": "~0.33.0",
|
|
131
125
|
"@dcspark/cardano-multiplatform-lib-browser": "^3.1.1",
|
|
132
126
|
"@emurgo/cardano-message-signing-asmjs": "^1.0.1",
|
|
133
127
|
"@types/bunyan": "^1.8.8",
|
|
@@ -181,5 +175,11 @@
|
|
|
181
175
|
"webpack-cli": "^4.9.2",
|
|
182
176
|
"webpack-merge": "^5.8.0"
|
|
183
177
|
},
|
|
184
|
-
"
|
|
178
|
+
"engines": {
|
|
179
|
+
"node": ">=16.20.2"
|
|
180
|
+
},
|
|
181
|
+
"publishConfig": {
|
|
182
|
+
"access": "public"
|
|
183
|
+
},
|
|
184
|
+
"gitHead": "bbefe52e9b7a4b01ce4c3c4bb07a540457fc0b9c"
|
|
185
185
|
}
|
package/src/factories.ts
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from '@cardano-sdk/cardano-services-client';
|
|
48
48
|
import { LedgerKeyAgent } from '@cardano-sdk/hardware-ledger';
|
|
49
49
|
import { Logger } from 'ts-log';
|
|
50
|
-
import { NodeTxSubmitProvider } from '@cardano-sdk/cardano-services';
|
|
50
|
+
import { NoCache, NodeTxSubmitProvider } from '@cardano-sdk/cardano-services';
|
|
51
51
|
import { OgmiosObservableCardanoNode } from '@cardano-sdk/ogmios';
|
|
52
52
|
import { TrezorKeyAgent } from '@cardano-sdk/hardware-trezor';
|
|
53
53
|
import { createStubStakePoolProvider } from '@cardano-sdk/util-dev';
|
|
@@ -165,8 +165,10 @@ txSubmitProviderFactory.register(OGMIOS_PROVIDER, async (params: any, logger: Lo
|
|
|
165
165
|
{
|
|
166
166
|
connectionConfig$: of(connectionConfig)
|
|
167
167
|
},
|
|
168
|
+
|
|
168
169
|
{ logger }
|
|
169
170
|
),
|
|
171
|
+
healthCheckCache: new NoCache(),
|
|
170
172
|
logger
|
|
171
173
|
})
|
|
172
174
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlockfrostAssetProvider, util } from '@cardano-sdk/cardano-services';
|
|
2
|
+
import { Cardano } from '@cardano-sdk/core';
|
|
3
|
+
import { logger } from '@cardano-sdk/util-dev';
|
|
4
|
+
|
|
5
|
+
describe('BlockfrostAssetProvider', () => {
|
|
6
|
+
test('getAsset', async () => {
|
|
7
|
+
const assetProvider = new BlockfrostAssetProvider({ blockfrost: util.getBlockfrostApi(), logger });
|
|
8
|
+
const asset = await assetProvider.getAsset({
|
|
9
|
+
assetId: Cardano.AssetId(
|
|
10
|
+
'b27160f0c50a9cf168bf945dcbfcabbfbee5c7a801e7b467093b41534d6574616c4d6f6e7374657230303036'
|
|
11
|
+
),
|
|
12
|
+
extraData: {
|
|
13
|
+
nftMetadata: true,
|
|
14
|
+
tokenMetadata: true
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
expect(asset.fingerprint).toEqual('asset1atvdgwr4xymq0d3jm90zzjzdywr9smj6h9qxsx');
|
|
18
|
+
expect(asset.name).toEqual('4d6574616c4d6f6e7374657230303036');
|
|
19
|
+
expect(asset.nftMetadata).toBeDefined();
|
|
20
|
+
expect(asset.nftMetadata?.image).toEqual('ipfs://QmcMBRFL5DdHbtDjaz5DHqSWgP7QkikRhdC4VPXu2m7qih');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { BlockfrostChainHistoryProvider, util } from '@cardano-sdk/cardano-services';
|
|
2
|
+
import { Cardano, ChainHistoryProvider } from '@cardano-sdk/core';
|
|
3
|
+
import { logger } from '@cardano-sdk/util-dev';
|
|
4
|
+
|
|
5
|
+
describe.only('BlockfrostChainHistoryProvider', () => {
|
|
6
|
+
let chainHistoryProvider: ChainHistoryProvider;
|
|
7
|
+
let blockfrost;
|
|
8
|
+
beforeAll(async () => {
|
|
9
|
+
blockfrost = util.getBlockfrostApi();
|
|
10
|
+
chainHistoryProvider = new BlockfrostChainHistoryProvider({
|
|
11
|
+
blockfrost,
|
|
12
|
+
logger
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('transactionsByHashes', () => {
|
|
17
|
+
it('parses metadata correctly', async () => {
|
|
18
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
19
|
+
ids: [Cardano.TransactionId('5127f8b235111854be744d36703f2098102d2639524035299658e73d683c0dfd')]
|
|
20
|
+
});
|
|
21
|
+
expect(tx.auxiliaryData!.blob!.get(1n)).toEqual(
|
|
22
|
+
new Map<string, string>([
|
|
23
|
+
['absolute_slot', '67255007'],
|
|
24
|
+
['timestamp', '1722938207']
|
|
25
|
+
])
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('has collaterals', async () => {
|
|
30
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
31
|
+
ids: [Cardano.TransactionId('b3c6c0712e103550de5cd6881a3c735e4d9dce04095628a8c9b1998556499775')]
|
|
32
|
+
|
|
33
|
+
// ids: [Cardano.TransactionId('97abd7079ab871a6d0693f08486df786a0dff24a888953179b60c58c7308c8ee')]
|
|
34
|
+
});
|
|
35
|
+
expect(tx.body.inputs!).toHaveLength(2);
|
|
36
|
+
expect(tx.body.outputs!).toHaveLength(3);
|
|
37
|
+
expect(tx.body.collaterals!).toHaveLength(1);
|
|
38
|
+
expect(tx.body.collaterals![0]).toEqual({
|
|
39
|
+
address: 'addr_test1vrupy5t9ufhxlpt5yd8d7euqz4cqjttz47qeg8yh4z6mu8ssz4vzl',
|
|
40
|
+
index: 0,
|
|
41
|
+
txId: 'b6b1692fd22680e06b136a013f3867eb2b73125671fe4cbe61037f0a5e17ccaa'
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('has collaterals for failed contract', async () => {
|
|
46
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
47
|
+
ids: [Cardano.TransactionId('3de3e581ead2b38d6ba1a82a282501e4447d7b6ae28e5fb4a340b9416d5ba6c5')]
|
|
48
|
+
});
|
|
49
|
+
expect(tx.inputSource).toBe(Cardano.InputSource.collaterals);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('has withdrawals', async () => {
|
|
53
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
54
|
+
ids: [Cardano.TransactionId('5929a59b9bebad1622f021d13b3d143d88cc92cf2400472e36ed8dcdf598a7fa')]
|
|
55
|
+
});
|
|
56
|
+
expect(tx.body.withdrawals).toEqual([
|
|
57
|
+
{ quantity: 26_283_930n, stakeAddress: 'stake_test1urlhkh2pl2xt24dkgjtqrkzfv77ekqj950znqpzdsz2wuds0xlsk6' }
|
|
58
|
+
]);
|
|
59
|
+
});
|
|
60
|
+
it('has redeemer', async () => {
|
|
61
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
62
|
+
ids: [Cardano.TransactionId('f0c157c84506f5f3ead133133d6a731c937ebd0df379ed518fdbad9ee53ba28b')]
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(tx.witness.redeemers).toBeDefined();
|
|
66
|
+
expect(tx.witness.redeemers).toHaveLength(1);
|
|
67
|
+
expect(tx.witness.redeemers![0].data).toBeDefined();
|
|
68
|
+
expect(tx.witness.redeemers![0]).toMatchObject({
|
|
69
|
+
executionUnits: { memory: 725_365, steps: 281_266_636 },
|
|
70
|
+
index: 0,
|
|
71
|
+
purpose: 'mint'
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('has mint', async () => {
|
|
76
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
77
|
+
ids: [Cardano.TransactionId('695757484882e86079f6723f58b3a83001566d72784236a91fed7746b344d6cd')]
|
|
78
|
+
});
|
|
79
|
+
expect(tx.body.mint!).toBeDefined();
|
|
80
|
+
expect(tx.body.mint!.size).toBe(10);
|
|
81
|
+
|
|
82
|
+
const tokenMap = new Map([
|
|
83
|
+
[
|
|
84
|
+
'2511e9ad0baa8c1a662e6eab1da2b7e501d2de729d1a317b909df24f4d656c642042616e6b204d616e61676572207631203739323731353033303537',
|
|
85
|
+
1n
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
'2511e9ad0baa8c1a662e6eab1da2b7e501d2de729d1a317b909df24f4d656c642042616e6b204d616e61676572207631203739323731353037313437',
|
|
89
|
+
1n
|
|
90
|
+
],
|
|
91
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e3744d454c44', 64_117_600_456n],
|
|
92
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e3744d494e', 583_838_935_714n],
|
|
93
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e374434f5049', 19_282_660_477n],
|
|
94
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e374484f534b59', 12_750_079_547n],
|
|
95
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e374574d54', 7_715_787_206n],
|
|
96
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e3744333', 967_881_787n],
|
|
97
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e374575254', 3_804_281_695n],
|
|
98
|
+
['f6f49b186751e61f1fb8c64e7504e771f968cea9f4d11f5222b169e37469555344', 1_112_936_042n]
|
|
99
|
+
]);
|
|
100
|
+
expect(tx.body.mint!).toEqual(tokenMap);
|
|
101
|
+
});
|
|
102
|
+
it('has StakeDelegation cert', async () => {
|
|
103
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
104
|
+
ids: [Cardano.TransactionId('b8412b0378dfba5442272dbb9de51dc1b462e789b9a1903723679e4549d3f4ef')]
|
|
105
|
+
});
|
|
106
|
+
expect(tx.body.certificates![0]).toEqual({
|
|
107
|
+
__typename: 'StakeDelegationCertificate',
|
|
108
|
+
cert_index: 1,
|
|
109
|
+
poolId: 'pool1z05xqzuxnpl8kg8u2wwg8ftng0fwtdluv3h20ruryfqc5gc3efl',
|
|
110
|
+
stakeCredential: {
|
|
111
|
+
hash: '94917a8771d16a6f0ecfdc53882dbd69710105e0709387fa9358bc99',
|
|
112
|
+
type: 0
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
it('has StakeKeyRegistration cert', async () => {
|
|
117
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
118
|
+
ids: [Cardano.TransactionId('b8412b0378dfba5442272dbb9de51dc1b462e789b9a1903723679e4549d3f4ef')]
|
|
119
|
+
});
|
|
120
|
+
expect(tx.body.certificates![1]).toEqual({
|
|
121
|
+
__typename: 'StakeRegistrationCertificate',
|
|
122
|
+
cert_index: 0,
|
|
123
|
+
stakeCredential: {
|
|
124
|
+
hash: '94917a8771d16a6f0ecfdc53882dbd69710105e0709387fa9358bc99',
|
|
125
|
+
type: 0
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
it('has StakeKeyDeregistration cert', async () => {
|
|
130
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
131
|
+
ids: [Cardano.TransactionId('78ed92583cd879c56e4dd49c06af303aa52e127074eac1123f727ed7eef36084')]
|
|
132
|
+
});
|
|
133
|
+
expect(tx.body.certificates![0]).toEqual({
|
|
134
|
+
__typename: 'StakeDeregistrationCertificate',
|
|
135
|
+
cert_index: 0,
|
|
136
|
+
stakeCredential: {
|
|
137
|
+
hash: '94917a8771d16a6f0ecfdc53882dbd69710105e0709387fa9358bc99',
|
|
138
|
+
type: 0
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
it('PoolRegistration poolParameters are not implemented (null)', async () => {
|
|
143
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
144
|
+
ids: [Cardano.TransactionId('17dff81aef66f0955963a06e1a63e35e60b3b89474f7c1277254dae6cf8592b8')]
|
|
145
|
+
});
|
|
146
|
+
expect(tx.body.certificates![1]).toEqual({
|
|
147
|
+
__typename: 'PoolRegistrationCertificate',
|
|
148
|
+
cert_index: 0,
|
|
149
|
+
poolId: 'pool1z05xqzuxnpl8kg8u2wwg8ftng0fwtdluv3h20ruryfqc5gc3efl',
|
|
150
|
+
poolParameters: null
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
it('has PoolRetirement cert', async () => {
|
|
154
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
155
|
+
ids: [Cardano.TransactionId('a6cfa382e0b41bb227a6ed8ce2eb58ec16f78fb6e0961f8824ca2039667c801f')]
|
|
156
|
+
});
|
|
157
|
+
expect(tx.body.certificates![0]).toEqual({
|
|
158
|
+
__typename: 'PoolRetirementCertificate',
|
|
159
|
+
cert_index: 0,
|
|
160
|
+
epoch: 152,
|
|
161
|
+
poolId: 'pool1mvgpsafktxs883p66awp7fplj73cj6j9hqdxzvqw494f7f0v2dp'
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
it.skip('has MoveInstantaneousRewards cert', async () => {
|
|
165
|
+
// @todo there is no Instantaneous Rewards in preprod https://preprod.beta.explorer.cardano.org/en/instantaneous-rewards
|
|
166
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({
|
|
167
|
+
ids: [Cardano.TransactionId('24986c0cd3475419bfb44756c27a0e13a6354a4071153f76a78f9b2d1e596089')]
|
|
168
|
+
});
|
|
169
|
+
expect(tx.body.certificates![0]).toEqual({
|
|
170
|
+
__typename: 'MirCertificate',
|
|
171
|
+
pot: 'treasury',
|
|
172
|
+
quantity: 100_000_000n,
|
|
173
|
+
rewardAccount: 'stake_test1uq6p9hn9u53kvmh4mu98c0d4zzuekp2nkelnynct5g26lqs9yenqu'
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
// TODO: blocked by https://github.com/input-output-hk/cardano-db-sync/issues/290
|
|
177
|
+
it.skip('has GenesisKeyDelegation cert', async () => {
|
|
178
|
+
const [tx] = await chainHistoryProvider.transactionsByHashes({ ids: [Cardano.TransactionId('someValue')] });
|
|
179
|
+
expect(tx.body.certificates![0]).toBeDefined();
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('transactionsByAddresses', () => {
|
|
184
|
+
it('Shelley address (addr_test1)', async () => {
|
|
185
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
186
|
+
addresses: [Cardano.PaymentAddress('addr_test1vz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerspjrlsz')],
|
|
187
|
+
pagination: { limit: 20, startAt: 0 }
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
expect(response.totalResultCount).toBeGreaterThanOrEqual(8);
|
|
191
|
+
|
|
192
|
+
expect(
|
|
193
|
+
response.pageResults.find(
|
|
194
|
+
(tx) => tx.id === Cardano.TransactionId('63b3fb0640cd6bc4c093e70aa8b9d0051f5afc99ad60e181da399fb4db230b0f')
|
|
195
|
+
)
|
|
196
|
+
).toBeDefined();
|
|
197
|
+
|
|
198
|
+
expect(
|
|
199
|
+
response.pageResults.find(
|
|
200
|
+
(tx) => tx.id === Cardano.TransactionId('6966174b495070898e9525158a1aaf2b2ee7976ea27bfdac9ca060d98160c204')
|
|
201
|
+
)
|
|
202
|
+
).toBeDefined();
|
|
203
|
+
});
|
|
204
|
+
it('extended Shelley address (addr_test1)', async () => {
|
|
205
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
206
|
+
addresses: [
|
|
207
|
+
Cardano.PaymentAddress(
|
|
208
|
+
'addr_test1qpvqf0y9sgpn92crff8cxrl95s0veay4gude7pgdn0tlvwv5j9agwuw3dfhsan7u2wyzm0tfwyqstcrsjwrl4y6chjvsneezuv'
|
|
209
|
+
)
|
|
210
|
+
],
|
|
211
|
+
pagination: { limit: 20, startAt: 0 }
|
|
212
|
+
});
|
|
213
|
+
expect(response.totalResultCount).toBeGreaterThanOrEqual(3);
|
|
214
|
+
|
|
215
|
+
expect(
|
|
216
|
+
response.pageResults.find(
|
|
217
|
+
(tx) => tx.id === Cardano.TransactionId('78ed92583cd879c56e4dd49c06af303aa52e127074eac1123f727ed7eef36084')
|
|
218
|
+
)
|
|
219
|
+
).toBeDefined();
|
|
220
|
+
|
|
221
|
+
expect(
|
|
222
|
+
response.pageResults.find(
|
|
223
|
+
(tx) => tx.id === Cardano.TransactionId('b8412b0378dfba5442272dbb9de51dc1b462e789b9a1903723679e4549d3f4ef')
|
|
224
|
+
)
|
|
225
|
+
).toBeDefined();
|
|
226
|
+
});
|
|
227
|
+
it('Icarus Byron address (2c)', async () => {
|
|
228
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
229
|
+
addresses: [Cardano.PaymentAddress('2cWKMJemoBahPCkbVybbhitWU1HQt6GV6J6CVtPp2TsbBKD5LLYdcNXaxQtNQnaYdrpfg')],
|
|
230
|
+
pagination: { limit: 20, startAt: 0 }
|
|
231
|
+
});
|
|
232
|
+
expect(response.totalResultCount).toBeGreaterThanOrEqual(1);
|
|
233
|
+
|
|
234
|
+
expect(
|
|
235
|
+
response.pageResults.find(
|
|
236
|
+
(tx) => tx.id === Cardano.TransactionId('1fb751b36dd7a237ddf6b6a0d681041cdce3b5775c72dcc7972f5c292c3c2e8b')
|
|
237
|
+
)
|
|
238
|
+
).toBeDefined();
|
|
239
|
+
});
|
|
240
|
+
// Failing because returned transactions are grouped by address
|
|
241
|
+
// TODO: update and reenable test when we decide behaviour
|
|
242
|
+
it('multiple address types', async () => {
|
|
243
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
244
|
+
addresses: [
|
|
245
|
+
Cardano.PaymentAddress('addr_test1vz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzerspjrlsz'),
|
|
246
|
+
Cardano.PaymentAddress(
|
|
247
|
+
'addr_test1qpvqf0y9sgpn92crff8cxrl95s0veay4gude7pgdn0tlvwv5j9agwuw3dfhsan7u2wyzm0tfwyqstcrsjwrl4y6chjvsneezuv'
|
|
248
|
+
),
|
|
249
|
+
Cardano.PaymentAddress('2cWKMJemoBahPCkbVybbhitWU1HQt6GV6J6CVtPp2TsbBKD5LLYdcNXaxQtNQnaYdrpfg')
|
|
250
|
+
],
|
|
251
|
+
pagination: { limit: 100, startAt: 0 }
|
|
252
|
+
});
|
|
253
|
+
expect(response.totalResultCount).toBeGreaterThanOrEqual(12);
|
|
254
|
+
|
|
255
|
+
expect(
|
|
256
|
+
response.pageResults.find(
|
|
257
|
+
(tx) => tx.id === Cardano.TransactionId('61eeefa4ab3262d0e66f4decece94dc3fc4d2381d132a0ac18bf7055d4dc3f56')
|
|
258
|
+
)
|
|
259
|
+
).toBeDefined();
|
|
260
|
+
|
|
261
|
+
expect(
|
|
262
|
+
response.pageResults.find(
|
|
263
|
+
(tx) => tx.id === Cardano.TransactionId('b8412b0378dfba5442272dbb9de51dc1b462e789b9a1903723679e4549d3f4ef')
|
|
264
|
+
)
|
|
265
|
+
).toBeDefined();
|
|
266
|
+
|
|
267
|
+
expect(
|
|
268
|
+
response.pageResults.find(
|
|
269
|
+
(tx) => tx.id === Cardano.TransactionId('1fb751b36dd7a237ddf6b6a0d681041cdce3b5775c72dcc7972f5c292c3c2e8b')
|
|
270
|
+
)
|
|
271
|
+
).toBeDefined();
|
|
272
|
+
});
|
|
273
|
+
it('Shelley address not used - no transactions', async () => {
|
|
274
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
275
|
+
addresses: [Cardano.PaymentAddress('addr_test1vrfxjeunkc9xu8rpnhgkluptaq0rm8kyxh8m3q9vtcetjwshvpnsm')],
|
|
276
|
+
pagination: { limit: 20, startAt: 0 }
|
|
277
|
+
});
|
|
278
|
+
expect(response.totalResultCount).toBe(0);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('queries successfully invalid transaction (script failure)', async () => {
|
|
282
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
283
|
+
addresses: [Cardano.PaymentAddress('addr_test1vqtcml25xg7p6udz6tvyulcnxeysswq8et7r48k8fdzk5kgwlyqxc')],
|
|
284
|
+
pagination: { limit: 20, startAt: 0 }
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const invalidTx = response.pageResults.find(
|
|
288
|
+
(tx) => tx.id === Cardano.TransactionId('3de3e581ead2b38d6ba1a82a282501e4447d7b6ae28e5fb4a340b9416d5ba6c5')
|
|
289
|
+
);
|
|
290
|
+
expect(invalidTx).toBeDefined();
|
|
291
|
+
expect(invalidTx?.inputSource).toBe(Cardano.InputSource.collaterals);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('returns transactions starting from blockRange param', async () => {
|
|
295
|
+
const address = Cardano.PaymentAddress(
|
|
296
|
+
'addr_test1qpvqf0y9sgpn92crff8cxrl95s0veay4gude7pgdn0tlvwv5j9agwuw3dfhsan7u2wyzm0tfwyqstcrsjwrl4y6chjvsneezuv'
|
|
297
|
+
);
|
|
298
|
+
const response = await chainHistoryProvider.transactionsByAddresses({
|
|
299
|
+
addresses: [address],
|
|
300
|
+
blockRange: { lowerBound: Cardano.BlockNo(3_348_548) },
|
|
301
|
+
pagination: { limit: 20, startAt: 0 }
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
expect(
|
|
305
|
+
response.pageResults.find(
|
|
306
|
+
(tx) => tx.id === Cardano.TransactionId('78ed92583cd879c56e4dd49c06af303aa52e127074eac1123f727ed7eef36084')
|
|
307
|
+
)
|
|
308
|
+
).toBeUndefined();
|
|
309
|
+
|
|
310
|
+
expect(response.totalResultCount).toBeGreaterThanOrEqual(3);
|
|
311
|
+
expect(response.pageResults.every((tx) => tx.blockHeader.blockNo >= Cardano.BlockNo(3_348_548))).toBe(true);
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
});
|
|
@@ -2,6 +2,7 @@ import { cip30 } from '@cardano-sdk/web-extension';
|
|
|
2
2
|
import { runtime } from 'webextension-polyfill';
|
|
3
3
|
import { cip30 as walletCip30 } from '@cardano-sdk/wallet';
|
|
4
4
|
|
|
5
|
+
import { NEVER } from 'rxjs';
|
|
5
6
|
import { authenticator } from './authenticator';
|
|
6
7
|
import { logger } from '../util';
|
|
7
8
|
import { wallet$ } from './walletManager';
|
|
@@ -12,12 +13,12 @@ const confirmationCallback: walletCip30.CallbackConfirmation = {
|
|
|
12
13
|
signData: async ({ sender }) => {
|
|
13
14
|
if (!sender) throw new Error('No sender context');
|
|
14
15
|
logger.info('signData request from', sender);
|
|
15
|
-
return
|
|
16
|
+
return { cancel$: NEVER };
|
|
16
17
|
},
|
|
17
18
|
signTx: async ({ sender }) => {
|
|
18
19
|
if (!sender) throw new Error('No sender context');
|
|
19
20
|
logger.info('signTx request', sender);
|
|
20
|
-
return
|
|
21
|
+
return { cancel$: NEVER };
|
|
21
22
|
},
|
|
22
23
|
submitTx: async () => true
|
|
23
24
|
};
|
|
@@ -10,6 +10,7 @@ require('dotenv').config({ path: path.join(__dirname, '../../', '.env') });
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
baseConfig: {
|
|
12
12
|
devtool: 'source-map',
|
|
13
|
+
externals: '@cardano-sdk/cardano-services',
|
|
13
14
|
ignoreWarnings: [/Failed to parse source map/],
|
|
14
15
|
mode: 'development',
|
|
15
16
|
module: {
|
|
@@ -53,6 +54,10 @@ module.exports = {
|
|
|
53
54
|
/@dcspark\/cardano-multiplatform-lib-nodejs/,
|
|
54
55
|
'@dcspark/cardano-multiplatform-lib-browser'
|
|
55
56
|
),
|
|
57
|
+
new NormalModuleReplacementPlugin(
|
|
58
|
+
/@emurgo\/cardano-serialization-lib-nodejs/,
|
|
59
|
+
'@emurgo/cardano-serialization-lib-asmjs'
|
|
60
|
+
),
|
|
56
61
|
new NormalModuleReplacementPlugin(/blake2b$/, 'blake2b-no-wasm'),
|
|
57
62
|
new NormalModuleReplacementPlugin(
|
|
58
63
|
/@emurgo\/cardano-message-signing-nodejs/,
|