@midnight-ntwrk/wallet-sdk-indexer-client 1.0.0-beta.11 → 1.0.0-beta.13

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.
Files changed (34) hide show
  1. package/dist/effect/ConnectionHelper.js +12 -0
  2. package/dist/effect/HttpQueryClient.js +12 -0
  3. package/dist/effect/Query.js +12 -0
  4. package/dist/effect/QueryClient.js +12 -0
  5. package/dist/effect/Subscription.js +12 -0
  6. package/dist/effect/SubscriptionClient.js +12 -0
  7. package/dist/effect/WsSubscriptionClient.js +12 -0
  8. package/dist/effect/index.js +12 -0
  9. package/dist/effect/test/httpQueryClient.spied.test.js +12 -0
  10. package/dist/effect/test/httpQueryClient.test.js +12 -0
  11. package/dist/effect/test/wsSubscriptionClient.spied.test.js +12 -0
  12. package/dist/effect/test/wsSubscriptionClient.test.js +12 -0
  13. package/dist/graphql/generated/fragment-masking.js +1 -1
  14. package/dist/graphql/generated/gql.d.ts +14 -14
  15. package/dist/graphql/generated/gql.js +7 -7
  16. package/dist/graphql/generated/graphql.d.ts +11 -0
  17. package/dist/graphql/generated/graphql.js +2 -2
  18. package/dist/graphql/generated/index.d.ts +2 -2
  19. package/dist/graphql/generated/index.js +2 -2
  20. package/dist/graphql/queries/BlockHash.js +13 -0
  21. package/dist/graphql/queries/Connect.js +12 -0
  22. package/dist/graphql/queries/Disconnect.js +12 -0
  23. package/dist/graphql/queries/index.js +12 -0
  24. package/dist/graphql/queries/test/BlockHash.test.js +31 -16
  25. package/dist/graphql/subscriptions/DustLedgerEvents.js +12 -0
  26. package/dist/graphql/subscriptions/ShieldedTransactions.js +12 -0
  27. package/dist/graphql/subscriptions/UnshieldedTransactions.js +19 -0
  28. package/dist/graphql/subscriptions/ZswapEvents.js +12 -0
  29. package/dist/graphql/subscriptions/index.js +12 -0
  30. package/dist/graphql/subscriptions/test/ShieldedTransactions.test.js +27 -13
  31. package/dist/graphql/subscriptions/test/UnshieldedTransactions.test.js +27 -13
  32. package/dist/graphql/subscriptions/test/ZswapEvents.test.js +27 -13
  33. package/dist/index.js +12 -0
  34. package/package.json +6 -4
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import * as Either from 'effect/Either';
2
14
  import { FailedToDeriveWebSocketUrlError } from '@midnight-ntwrk/wallet-sdk-utilities/networking';
3
15
  export const deriveWebSocketUrl = (url) => {
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Layer } from 'effect';
2
14
  import { print } from 'graphql';
3
15
  import { createClient } from 'graphql-http';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Context, Effectable, Option, identity } from 'effect';
2
14
  import { QueryClient } from './QueryClient.js';
3
15
  /**
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Context } from 'effect';
2
14
  export class QueryClient extends Context.Tag('@midnight-ntwrk/indexer-client#QueryClient')() {
3
15
  }
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Stream, Context, Effectable, Option, identity } from 'effect';
2
14
  import { SubscriptionClient } from './SubscriptionClient.js';
3
15
  export const make = (name, document) => new SubscriptionImpl(`${name}Subscription`, document);
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Context } from 'effect';
2
14
  export class SubscriptionClient extends Context.Tag('@midnight-ntwrk/indexer-client#SubscriptionClient')() {
3
15
  }
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Stream, Layer } from 'effect';
2
14
  import { createClient } from 'graphql-ws';
3
15
  import { print } from 'graphql';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * as Query from './Query.js';
2
14
  export * as Subscription from './Subscription.js';
3
15
  export * from './QueryClient.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect } from 'effect';
2
14
  import { describe, expect, it, vi } from 'vitest';
3
15
  import * as QueryClient from '../QueryClient.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect } from 'effect';
2
14
  import { describe, it } from 'vitest';
3
15
  import * as QueryClient from '../QueryClient.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect } from 'effect';
2
14
  import { describe, expect, it, vi } from 'vitest';
3
15
  import * as SubscriptionClient from '../SubscriptionClient.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect } from 'effect';
2
14
  import { describe, it } from 'vitest';
3
15
  import * as SubscriptionClient from '../SubscriptionClient.js';
@@ -12,5 +12,5 @@ export function isFragmentReady(queryNode, fragmentNode, data) {
12
12
  const fragDef = fragmentNode.definitions[0];
13
13
  const fragName = fragDef?.name?.value;
14
14
  const fields = (fragName && deferredFields[fragName]) || [];
15
- return fields.length > 0 && fields.every((field) => data && field in data);
15
+ return fields.length > 0 && fields.every(field => data && field in data);
16
16
  }
@@ -12,13 +12,13 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
12
12
  * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
13
13
  */
14
14
  type Documents = {
15
- '\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n }\n }\n ': typeof types.BlockHashDocument;
16
- '\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n ': typeof types.ConnectDocument;
17
- '\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n ': typeof types.DisconnectDocument;
18
- '\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n ': typeof types.DustLedgerEventsDocument;
19
- '\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n ': typeof types.ShieldedTransactionsDocument;
20
- '\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n ... on RegularTransaction {\n identifiers\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n ': typeof types.UnshieldedTransactionsDocument;
21
- '\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n ': typeof types.ZswapEventsDocument;
15
+ "\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n timestamp\n }\n }\n ": typeof types.BlockHashDocument;
16
+ "\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n ": typeof types.ConnectDocument;
17
+ "\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n ": typeof types.DisconnectDocument;
18
+ "\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n ": typeof types.DustLedgerEventsDocument;
19
+ "\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n ": typeof types.ShieldedTransactionsDocument;
20
+ "\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n block {\n timestamp\n }\n ... on RegularTransaction {\n identifiers\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n ": typeof types.UnshieldedTransactionsDocument;
21
+ "\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n ": typeof types.ZswapEventsDocument;
22
22
  };
23
23
  declare const documents: Documents;
24
24
  /**
@@ -37,30 +37,30 @@ export declare function gql(source: string): unknown;
37
37
  /**
38
38
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
39
39
  */
40
- export declare function gql(source: '\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n }\n }\n '): (typeof documents)['\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n }\n }\n '];
40
+ export declare function gql(source: "\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n timestamp\n }\n }\n "): (typeof documents)["\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n timestamp\n }\n }\n "];
41
41
  /**
42
42
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
43
43
  */
44
- export declare function gql(source: '\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n '): (typeof documents)['\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n '];
44
+ export declare function gql(source: "\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n "): (typeof documents)["\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n "];
45
45
  /**
46
46
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
47
47
  */
48
- export declare function gql(source: '\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n '): (typeof documents)['\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n '];
48
+ export declare function gql(source: "\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n "): (typeof documents)["\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n "];
49
49
  /**
50
50
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
51
51
  */
52
- export declare function gql(source: '\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n '): (typeof documents)['\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n '];
52
+ export declare function gql(source: "\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n "): (typeof documents)["\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n "];
53
53
  /**
54
54
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
55
55
  */
56
- export declare function gql(source: '\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n '): (typeof documents)['\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n '];
56
+ export declare function gql(source: "\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n "): (typeof documents)["\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n "];
57
57
  /**
58
58
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
59
59
  */
60
- export declare function gql(source: '\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n ... on RegularTransaction {\n identifiers\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n '): (typeof documents)['\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n ... on RegularTransaction {\n identifiers\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n '];
60
+ export declare function gql(source: "\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n block {\n timestamp\n }\n ... on RegularTransaction {\n identifiers\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n "): (typeof documents)["\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n block {\n timestamp\n }\n ... on RegularTransaction {\n identifiers\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n "];
61
61
  /**
62
62
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
63
63
  */
64
- export declare function gql(source: '\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n '): (typeof documents)['\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n '];
64
+ export declare function gql(source: "\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n "): (typeof documents)["\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n "];
65
65
  export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
66
66
  export {};
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable */
2
2
  import * as types from './graphql.js';
3
3
  const documents = {
4
- '\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n }\n }\n ': types.BlockHashDocument,
5
- '\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n ': types.ConnectDocument,
6
- '\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n ': types.DisconnectDocument,
7
- '\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n ': types.DustLedgerEventsDocument,
8
- '\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n ': types.ShieldedTransactionsDocument,
9
- '\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n ... on RegularTransaction {\n identifiers\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n ': types.UnshieldedTransactionsDocument,
10
- '\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n ': types.ZswapEventsDocument,
4
+ "\n query BlockHash($offset: BlockOffset) {\n block(offset: $offset) {\n height\n hash\n ledgerParameters\n timestamp\n }\n }\n ": types.BlockHashDocument,
5
+ "\n mutation Connect($viewingKey: ViewingKey!) {\n connect(viewingKey: $viewingKey)\n }\n ": types.ConnectDocument,
6
+ "\n mutation Disconnect($sessionId: HexEncoded!) {\n disconnect(sessionId: $sessionId)\n }\n ": types.DisconnectDocument,
7
+ "\n subscription DustLedgerEvents($id: Int) {\n dustLedgerEvents(id: $id) {\n type: __typename\n id\n raw\n maxId\n }\n }\n ": types.DustLedgerEventsDocument,
8
+ "\n subscription ShieldedTransactions($sessionId: HexEncoded!, $index: Int) {\n shieldedTransactions(sessionId: $sessionId, index: $index) {\n __typename\n ... on ShieldedTransactionsProgress {\n highestEndIndex\n highestCheckedEndIndex\n highestRelevantEndIndex\n }\n ... on RelevantTransaction {\n transaction {\n id\n raw\n hash\n protocolVersion\n identifiers\n startIndex\n endIndex\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n collapsedMerkleTree {\n startIndex\n endIndex\n update\n protocolVersion\n }\n }\n }\n }\n ": types.ShieldedTransactionsDocument,
9
+ "\n subscription UnshieldedTransactions($address: UnshieldedAddress!, $transactionId: Int) {\n unshieldedTransactions(address: $address, transactionId: $transactionId) {\n ... on UnshieldedTransaction {\n type: __typename\n transaction {\n type: __typename\n id\n hash\n protocolVersion\n block {\n timestamp\n }\n ... on RegularTransaction {\n identifiers\n fees {\n paidFees\n estimatedFees\n }\n transactionResult {\n status\n segments {\n id\n success\n }\n }\n }\n }\n createdUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n spentUtxos {\n owner\n tokenType\n value\n outputIndex\n intentHash\n ctime\n registeredForDustGeneration\n }\n }\n ... on UnshieldedTransactionsProgress {\n type: __typename\n highestTransactionId\n }\n }\n }\n ": types.UnshieldedTransactionsDocument,
10
+ "\n subscription ZswapEvents($id: Int) {\n zswapLedgerEvents(id: $id) {\n id\n raw\n maxId\n }\n }\n ": types.ZswapEventsDocument,
11
11
  };
12
12
  export function gql(source) {
13
13
  return documents[source] ?? {};
@@ -508,6 +508,7 @@ export type BlockHashQuery = {
508
508
  height: number;
509
509
  hash: string;
510
510
  ledgerParameters: string;
511
+ timestamp: number;
511
512
  } | null;
512
513
  };
513
514
  export type ConnectMutationVariables = Exact<{
@@ -601,6 +602,10 @@ export type UnshieldedTransactionsSubscription = {
601
602
  hash: string;
602
603
  protocolVersion: number;
603
604
  type: 'RegularTransaction';
605
+ fees: {
606
+ paidFees: string;
607
+ estimatedFees: string;
608
+ };
604
609
  transactionResult: {
605
610
  status: TransactionResultStatus;
606
611
  segments: Array<{
@@ -608,11 +613,17 @@ export type UnshieldedTransactionsSubscription = {
608
613
  success: boolean;
609
614
  }> | null;
610
615
  };
616
+ block: {
617
+ timestamp: number;
618
+ };
611
619
  } | {
612
620
  id: number;
613
621
  hash: string;
614
622
  protocolVersion: number;
615
623
  type: 'SystemTransaction';
624
+ block: {
625
+ timestamp: number;
626
+ };
616
627
  };
617
628
  createdUtxos: Array<{
618
629
  owner: string;
@@ -1,7 +1,7 @@
1
- export const BlockHashDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "BlockHash" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BlockOffset" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "offset" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "height" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ledgerParameters" } }] } }] } }] };
1
+ export const BlockHashDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "BlockHash" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BlockOffset" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "offset" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "height" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ledgerParameters" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }] } }] } }] };
2
2
  export const ConnectDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "Connect" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "viewingKey" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ViewingKey" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "connect" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "viewingKey" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "viewingKey" } } }] }] } }] };
3
3
  export const DisconnectDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "Disconnect" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "HexEncoded" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "disconnect" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }] }] } }] };
4
4
  export const DustLedgerEventsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "DustLedgerEvents" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "dustLedgerEvents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "raw" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxId" } }] } }] } }] };
5
5
  export const ShieldedTransactionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "ShieldedTransactions" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "HexEncoded" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "index" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "shieldedTransactions" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "index" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "index" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ShieldedTransactionsProgress" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "highestEndIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "highestCheckedEndIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "highestRelevantEndIndex" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "RelevantTransaction" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "transaction" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "raw" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "protocolVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "identifiers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "fees" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "paidFees" } }, { "kind": "Field", "name": { "kind": "Name", "value": "estimatedFees" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "transactionResult" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "segments" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "success" } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "collapsedMerkleTree" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "startIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "update" } }, { "kind": "Field", "name": { "kind": "Name", "value": "protocolVersion" } }] } }] } }] } }] } }] };
6
- export const UnshieldedTransactionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "UnshieldedTransactions" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedAddress" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "transactionId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "unshieldedTransactions" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "address" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "transactionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "transactionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedTransaction" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "transaction" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "protocolVersion" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "RegularTransaction" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "identifiers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "transactionResult" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "segments" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "success" } }] } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdUtxos" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "owner" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tokenType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "intentHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ctime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "registeredForDustGeneration" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "spentUtxos" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "owner" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tokenType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "intentHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ctime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "registeredForDustGeneration" } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedTransactionsProgress" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "highestTransactionId" } }] } }] } }] } }] };
6
+ export const UnshieldedTransactionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "UnshieldedTransactions" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedAddress" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "transactionId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "unshieldedTransactions" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "address" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "transactionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "transactionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedTransaction" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "transaction" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "protocolVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "block" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "RegularTransaction" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "identifiers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "fees" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "paidFees" } }, { "kind": "Field", "name": { "kind": "Name", "value": "estimatedFees" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "transactionResult" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "segments" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "success" } }] } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdUtxos" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "owner" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tokenType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "intentHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ctime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "registeredForDustGeneration" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "spentUtxos" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "owner" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tokenType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "intentHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ctime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "registeredForDustGeneration" } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "UnshieldedTransactionsProgress" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "type" }, "name": { "kind": "Name", "value": "__typename" } }, { "kind": "Field", "name": { "kind": "Name", "value": "highestTransactionId" } }] } }] } }] } }] };
7
7
  export const ZswapEventsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "ZswapEvents" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "zswapLedgerEvents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "raw" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxId" } }] } }] } }] };
@@ -1,2 +1,2 @@
1
- export * from './fragment-masking.js';
2
- export * from './gql.js';
1
+ export * from "./fragment-masking.js";
2
+ export * from "./gql.js";
@@ -1,2 +1,2 @@
1
- export * from './fragment-masking.js';
2
- export * from './gql.js';
1
+ export * from "./fragment-masking.js";
2
+ export * from "./gql.js";
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Query } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const BlockHash = Query.make('BlockHash', gql(`
@@ -6,6 +18,7 @@ export const BlockHash = Query.make('BlockHash', gql(`
6
18
  height
7
19
  hash
8
20
  ledgerParameters
21
+ timestamp
9
22
  }
10
23
  }
11
24
  `));
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Query } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const Connect = Query.make('Connect', gql(`
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Query } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const Disconnect = Query.make('Disconnect', gql(`
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * from './Connect.js';
2
14
  export * from './Disconnect.js';
3
15
  export * from './BlockHash.js';
@@ -1,31 +1,45 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
14
  import { Effect, Option } from 'effect';
3
15
  import { randomUUID } from 'node:crypto';
4
- import * as path from 'node:path';
16
+ import { buildTestEnvironmentVariables, getComposeDirectory } from '@midnight-ntwrk/wallet-sdk-utilities/testing';
5
17
  import { DockerComposeEnvironment, Wait } from 'testcontainers';
6
18
  import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
7
19
  import { HttpQueryClient } from '../../../effect/index.js';
8
20
  import { BlockHash } from '../BlockHash.js';
9
- const COMPOSE_PATH = path.resolve(new URL(import.meta.url).pathname, '../../../../../');
10
21
  const timeout_minutes = (mins) => 1_000 * 60 * mins;
22
+ const environmentId = randomUUID();
23
+ const environmentVars = buildTestEnvironmentVariables(['APP_INFRA_SECRET'], {
24
+ additionalVars: {
25
+ TESTCONTAINERS_UID: environmentId,
26
+ },
27
+ });
28
+ const environment = new DockerComposeEnvironment(getComposeDirectory(), 'docker-compose.yml')
29
+ // The test below assumes indexer is able to serve blocks, so we wait for it to index at least one block
30
+ // Otherwise the test below would be flakey or not precise enough to be useful
31
+ // Inspecting logs is not the best idea, but here it's the only way
32
+ .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
33
+ .withEnvironment(environmentVars);
11
34
  describe('BlockHash query', () => {
12
35
  describe('with available Indexer Server', () => {
13
- const environmentId = randomUUID();
14
- let environment = undefined;
15
- const getIndexerPort = () => environment?.getContainer(`indexer_${environmentId}`)?.getMappedPort(8088) ?? 8088;
36
+ let startedEnvironment = undefined;
37
+ const getIndexerPort = () => startedEnvironment?.getContainer(`indexer_${environmentId}`)?.getMappedPort(8088) ?? 8088;
16
38
  beforeAll(async () => {
17
- environment = await new DockerComposeEnvironment(COMPOSE_PATH, 'docker-compose.yml')
18
- .withEnvironment({
19
- TESTCONTAINERS_UID: environmentId,
20
- })
21
- // The test below assumes indexer is able to serve blocks, so we wait for it to index at least one block
22
- // Otherwise the test below would be flakey or not precise enough to be useful
23
- // Inspecting logs is not the best idea, but here it's the only way
24
- .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
25
- .up();
39
+ startedEnvironment = await environment.up();
26
40
  }, timeout_minutes(3));
27
41
  afterAll(async () => {
28
- await environment?.down();
42
+ await startedEnvironment?.down();
29
43
  }, timeout_minutes(1));
30
44
  it('should fail with ClientError for unknown URL', async () => {
31
45
  await BlockHash.run({ offset: null }).pipe(Effect.catchSome((err) => (err._tag === 'ClientError' ? Option.some(Effect.succeed(void 0)) : Option.none())), Effect.catchAll((err) => Effect.fail(`Encountered unexpected '${err._tag}' error: ${err.message}`)), Effect.flatMap((data) => (data ? Effect.fail('Unexpectedly received data') : Effect.succeed(void 0))), Effect.provide(HttpQueryClient.layer({ url: `http://127.0.0.1:${getIndexerPort()}/a__p__i/v3/graphql` })), Effect.scoped, Effect.runPromise);
@@ -46,12 +60,13 @@ describe('BlockHash query', () => {
46
60
  }, timeout_minutes(1));
47
61
  });
48
62
  it('should support query function injection', async () => {
49
- const block = { block: { height: 1_000, hash: 'SOME_HASH', ledgerParameters: '0x0' } };
63
+ const block = { block: { height: 1_000, hash: 'SOME_HASH', ledgerParameters: '0x0', timestamp: 1 } };
50
64
  const blockExpectation = expect.objectContaining({
51
65
  block: expect.objectContaining({
52
66
  height: block.block.height,
53
67
  hash: block.block.hash,
54
68
  ledgerParameters: block.block.ledgerParameters,
69
+ timestamp: block.block.timestamp,
55
70
  }),
56
71
  });
57
72
  const mockedQueryFn = vi.fn();
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Subscription } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const DustLedgerEvents = Subscription.make('DustLedgerEvents', gql(`
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Subscription } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const ShieldedTransactions = Subscription.make('ShieldedTransactions', gql(`
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Subscription } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const UnshieldedTransactions = Subscription.make('UnshieldedTransactions', gql(`
@@ -10,8 +22,15 @@ export const UnshieldedTransactions = Subscription.make('UnshieldedTransactions'
10
22
  id
11
23
  hash
12
24
  protocolVersion
25
+ block {
26
+ timestamp
27
+ }
13
28
  ... on RegularTransaction {
14
29
  identifiers
30
+ fees {
31
+ paidFees
32
+ estimatedFees
33
+ }
15
34
  transactionResult {
16
35
  status
17
36
  segments {
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Subscription } from '../../effect/index.js';
2
14
  import { gql } from '../generated/index.js';
3
15
  export const ZswapEvents = Subscription.make('ZswapEvents', gql(`
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * from './DustLedgerEvents.js';
2
14
  export * from './ShieldedTransactions.js';
3
15
  export * from './UnshieldedTransactions.js';
@@ -1,30 +1,44 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Stream } from 'effect';
2
14
  import { randomUUID } from 'node:crypto';
3
- import * as path from 'node:path';
15
+ import { buildTestEnvironmentVariables, getComposeDirectory } from '@midnight-ntwrk/wallet-sdk-utilities/testing';
4
16
  import { DockerComposeEnvironment, Wait } from 'testcontainers';
5
17
  import { afterAll, beforeAll, describe, expect, it } from 'vitest';
6
18
  import { HttpQueryClient, WsSubscriptionClient } from '../../../effect/index.js';
7
19
  import { Connect, Disconnect } from '../../queries/index.js';
8
20
  import { ShieldedTransactions } from '../ShieldedTransactions.js';
9
- const COMPOSE_PATH = path.resolve(new URL(import.meta.url).pathname, '../../../../../');
10
21
  const KNOWN_VIEWING_KEY = 'mn_shield-esk_undeployed1d45kgmnfva58gwn9de3hy7tsw35k7m3dwdjkxun9wskkketetdmrzhf6dlyj7u8juj68fd4psnkqhjxh32sec0q480vzswg8kd485e2kljcsmxqc0u';
11
22
  const timeout_minutes = (mins) => 1_000 * 60 * mins;
23
+ const environmentId = randomUUID();
24
+ const environmentVars = buildTestEnvironmentVariables(['APP_INFRA_SECRET'], {
25
+ additionalVars: {
26
+ TESTCONTAINERS_UID: environmentId,
27
+ },
28
+ });
29
+ const environment = new DockerComposeEnvironment(getComposeDirectory(), 'docker-compose.yml')
30
+ .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
31
+ .withWaitStrategy(`indexer_${environmentId}`, Wait.forListeningPorts())
32
+ .withEnvironment(environmentVars);
12
33
  describe('Wallet subscription', () => {
13
34
  describe('with available Indexer Server', () => {
14
- const environmentId = randomUUID();
15
- let environment = undefined;
16
- const getIndexerPort = () => environment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
35
+ let startedEnvironment = undefined;
36
+ const getIndexerPort = () => startedEnvironment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
17
37
  beforeAll(async () => {
18
- environment = await new DockerComposeEnvironment(COMPOSE_PATH, 'docker-compose.yml')
19
- .withEnvironment({
20
- TESTCONTAINERS_UID: environmentId,
21
- })
22
- .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
23
- .withWaitStrategy(`indexer_${environmentId}`, Wait.forListeningPorts())
24
- .up();
38
+ startedEnvironment = await environment.up();
25
39
  }, timeout_minutes(3));
26
40
  afterAll(async () => {
27
- await environment?.down();
41
+ await startedEnvironment?.down();
28
42
  }, timeout_minutes(1));
29
43
  it('should stream GraphQL subscription', async () => {
30
44
  const makeScopedSession = Effect.acquireRelease(Connect.run({ viewingKey: KNOWN_VIEWING_KEY }), (session) => Disconnect.run({ sessionId: session.connect }).pipe(Effect.catchAll((_) => Effect.void)));
@@ -1,29 +1,43 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Stream } from 'effect';
2
14
  import { randomUUID } from 'node:crypto';
3
- import * as path from 'node:path';
15
+ import { buildTestEnvironmentVariables, getComposeDirectory } from '@midnight-ntwrk/wallet-sdk-utilities/testing';
4
16
  import { DockerComposeEnvironment, Wait } from 'testcontainers';
5
17
  import { afterAll, beforeAll, describe, expect, it } from 'vitest';
6
18
  import { WsSubscriptionClient } from '../../../effect/index.js';
7
19
  import { UnshieldedTransactions } from '../UnshieldedTransactions.js';
8
- const COMPOSE_PATH = path.resolve(new URL(import.meta.url).pathname, '../../../../../');
9
20
  const timeout_minutes = (mins) => 1_000 * 60 * mins;
10
21
  const ADDRESS = 'mn_addr_undeployed1rhqz8aq6t74ym2uq5gh53t9x02gducxnamtdvnjxfhelxwaf8ztqpmrwwj';
22
+ const environmentId = randomUUID();
23
+ const environmentVars = buildTestEnvironmentVariables(['APP_INFRA_SECRET'], {
24
+ additionalVars: {
25
+ TESTCONTAINERS_UID: environmentId,
26
+ },
27
+ });
28
+ const environment = new DockerComposeEnvironment(getComposeDirectory(), 'docker-compose.yml')
29
+ .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
30
+ .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
31
+ .withEnvironment(environmentVars);
11
32
  describe('Wallet subscription', () => {
12
33
  describe('with available Indexer Server', () => {
13
- const environmentId = randomUUID();
14
- let environment = undefined;
15
- const getIndexerPort = () => environment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
34
+ let startedEnvironment = undefined;
35
+ const getIndexerPort = () => startedEnvironment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
16
36
  beforeAll(async () => {
17
- environment = await new DockerComposeEnvironment(COMPOSE_PATH, 'docker-compose.yml')
18
- .withEnvironment({
19
- TESTCONTAINERS_UID: environmentId,
20
- })
21
- .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
22
- .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
23
- .up();
37
+ startedEnvironment = await environment.up();
24
38
  }, timeout_minutes(3));
25
39
  afterAll(async () => {
26
- await environment?.down();
40
+ await startedEnvironment?.down();
27
41
  }, timeout_minutes(1));
28
42
  it('should stream GraphQL subscription', async () => {
29
43
  await Effect.gen(function* () {
@@ -1,28 +1,42 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Effect, Stream } from 'effect';
2
14
  import { randomUUID } from 'node:crypto';
3
- import * as path from 'node:path';
15
+ import { buildTestEnvironmentVariables, getComposeDirectory } from '@midnight-ntwrk/wallet-sdk-utilities/testing';
4
16
  import { DockerComposeEnvironment, Wait } from 'testcontainers';
5
17
  import { afterAll, beforeAll, describe, expect, it } from 'vitest';
6
18
  import { WsSubscriptionClient } from '../../../effect/index.js';
7
19
  import { ZswapEvents } from '../ZswapEvents.js';
8
- const COMPOSE_PATH = path.resolve(new URL(import.meta.url).pathname, '../../../../../');
9
20
  const timeout_minutes = (mins) => 1_000 * 60 * mins;
21
+ const environmentId = randomUUID();
22
+ const environmentVars = buildTestEnvironmentVariables(['APP_INFRA_SECRET'], {
23
+ additionalVars: {
24
+ TESTCONTAINERS_UID: environmentId,
25
+ },
26
+ });
27
+ const environment = new DockerComposeEnvironment(getComposeDirectory(), 'docker-compose.yml')
28
+ .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
29
+ .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
30
+ .withEnvironment(environmentVars);
10
31
  describe('ZSwap events subscription', () => {
11
32
  describe('with available Indexer Server', () => {
12
- const environmentId = randomUUID();
13
- let environment = undefined;
14
- const getIndexerPort = () => environment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
33
+ let startedEnvironment = undefined;
34
+ const getIndexerPort = () => startedEnvironment?.getContainer(`indexer_${environmentId}`).getMappedPort(8088) ?? 8088;
15
35
  beforeAll(async () => {
16
- environment = await new DockerComposeEnvironment(COMPOSE_PATH, 'docker-compose.yml')
17
- .withEnvironment({
18
- TESTCONTAINERS_UID: environmentId,
19
- })
20
- .withWaitStrategy(`node_${environmentId}`, Wait.forListeningPorts())
21
- .withWaitStrategy(`indexer_${environmentId}`, Wait.forLogMessage(/block indexed/))
22
- .up();
36
+ startedEnvironment = await environment.up();
23
37
  }, timeout_minutes(3));
24
38
  afterAll(async () => {
25
- await environment?.down();
39
+ await startedEnvironment?.down();
26
40
  }, timeout_minutes(1));
27
41
  it('should stream GraphQL subscription', async () => {
28
42
  await Effect.gen(function* () {
package/dist/index.js CHANGED
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * from './graphql/queries/index.js';
2
14
  export * from './graphql/subscriptions/index.js';
3
15
  export * from './graphql/generated/graphql.js';
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/wallet-sdk-indexer-client",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.13",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "author": "IOHK",
7
+ "author": "Midnight Foundation",
8
8
  "license": "Apache-2.0",
9
9
  "publishConfig": {
10
10
  "registry": "https://npm.pkg.github.com/"
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@effect/platform": "^0.90.0",
31
31
  "@graphql-typed-document-node/core": "^3.2.0",
32
- "@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0-beta.8",
32
+ "@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0-beta.9",
33
33
  "@midnight-ntwrk/wallet-sdk-utilities": "1.0.0-beta.7",
34
34
  "effect": "^3.17.3",
35
35
  "graphql": "^16.11.0",
@@ -44,13 +44,15 @@
44
44
  "eslint": "^9.37.0",
45
45
  "publint": "~0.3.14",
46
46
  "rimraf": "^6.0.1",
47
- "testcontainers": "^11.4.0",
47
+ "testcontainers": "^11.8.1",
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^3.2.4"
50
50
  },
51
51
  "scripts": {
52
52
  "gql:codegen": "graphql-codegen",
53
53
  "typecheck": "tsc -b ./tsconfig.json --noEmit",
54
+ "format": "prettier --write \"**/*.{ts,js,json,yaml,yml,md}\"",
55
+ "format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml,md}\"",
54
56
  "test": "vitest run",
55
57
  "lint": "eslint",
56
58
  "dist": "tsc -b ./tsconfig.build.json",