@console-wallet/dapp-sdk 0.0.17

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 (158) hide show
  1. package/README.md +153 -0
  2. package/dist/cjs/api/generated-wallet-api.d.ts +417 -0
  3. package/dist/cjs/api/generated-wallet-api.js +264 -0
  4. package/dist/cjs/api/generated-wallet-api.js.map +1 -0
  5. package/dist/cjs/constants/config.constants.d.ts +1 -0
  6. package/dist/cjs/constants/config.constants.js +5 -0
  7. package/dist/cjs/constants/config.constants.js.map +1 -0
  8. package/dist/cjs/constants/index.d.ts +1 -0
  9. package/dist/cjs/constants/index.js +5 -0
  10. package/dist/cjs/constants/index.js.map +1 -0
  11. package/dist/cjs/helpers/handleResponce.helper.d.ts +3 -0
  12. package/dist/cjs/helpers/handleResponce.helper.js +26 -0
  13. package/dist/cjs/helpers/handleResponce.helper.js.map +1 -0
  14. package/dist/cjs/index.d.ts +19 -0
  15. package/dist/cjs/index.js +14 -0
  16. package/dist/cjs/index.js.map +1 -0
  17. package/dist/cjs/requests/connect.d.ts +2 -0
  18. package/dist/cjs/requests/connect.js +25 -0
  19. package/dist/cjs/requests/connect.js.map +1 -0
  20. package/dist/cjs/requests/getAccounts.d.ts +2 -0
  21. package/dist/cjs/requests/getAccounts.js +23 -0
  22. package/dist/cjs/requests/getAccounts.js.map +1 -0
  23. package/dist/cjs/requests/getIsConnected.d.ts +2 -0
  24. package/dist/cjs/requests/getIsConnected.js +23 -0
  25. package/dist/cjs/requests/getIsConnected.js.map +1 -0
  26. package/dist/cjs/requests/index.d.ts +5 -0
  27. package/dist/cjs/requests/index.js +9 -0
  28. package/dist/cjs/requests/index.js.map +1 -0
  29. package/dist/cjs/requests/signMessage.d.ts +2 -0
  30. package/dist/cjs/requests/signMessage.js +24 -0
  31. package/dist/cjs/requests/signMessage.js.map +1 -0
  32. package/dist/cjs/requests/signSend.d.ts +2 -0
  33. package/dist/cjs/requests/signSend.js +24 -0
  34. package/dist/cjs/requests/signSend.js.map +1 -0
  35. package/dist/cjs/types/account.type.d.ts +7 -0
  36. package/dist/cjs/types/account.type.js +3 -0
  37. package/dist/cjs/types/account.type.js.map +1 -0
  38. package/dist/cjs/types/communication.types.d.ts +19 -0
  39. package/dist/cjs/types/communication.types.js +19 -0
  40. package/dist/cjs/types/communication.types.js.map +1 -0
  41. package/dist/cjs/types/connect.type.d.ts +8 -0
  42. package/dist/cjs/types/connect.type.js +3 -0
  43. package/dist/cjs/types/connect.type.js.map +1 -0
  44. package/dist/cjs/types/index.d.ts +4 -0
  45. package/dist/cjs/types/index.js +8 -0
  46. package/dist/cjs/types/index.js.map +1 -0
  47. package/dist/cjs/types/signed.type.d.ts +25 -0
  48. package/dist/cjs/types/signed.type.js +3 -0
  49. package/dist/cjs/types/signed.type.js.map +1 -0
  50. package/dist/cjs/utils/checks/equalBytes.d.ts +1 -0
  51. package/dist/cjs/utils/checks/equalBytes.js +10 -0
  52. package/dist/cjs/utils/checks/equalBytes.js.map +1 -0
  53. package/dist/cjs/utils/checks/index.d.ts +1 -0
  54. package/dist/cjs/utils/checks/index.js +5 -0
  55. package/dist/cjs/utils/checks/index.js.map +1 -0
  56. package/dist/cjs/utils/index.d.ts +2 -0
  57. package/dist/cjs/utils/index.js +6 -0
  58. package/dist/cjs/utils/index.js.map +1 -0
  59. package/dist/cjs/utils/parsers/base64ToBytes.d.ts +1 -0
  60. package/dist/cjs/utils/parsers/base64ToBytes.js +9 -0
  61. package/dist/cjs/utils/parsers/base64ToBytes.js.map +1 -0
  62. package/dist/cjs/utils/parsers/base64toHex.d.ts +1 -0
  63. package/dist/cjs/utils/parsers/base64toHex.js +11 -0
  64. package/dist/cjs/utils/parsers/base64toHex.js.map +1 -0
  65. package/dist/cjs/utils/parsers/hexToBase64.d.ts +1 -0
  66. package/dist/cjs/utils/parsers/hexToBase64.js +13 -0
  67. package/dist/cjs/utils/parsers/hexToBase64.js.map +1 -0
  68. package/dist/cjs/utils/parsers/hexToBytes.d.ts +1 -0
  69. package/dist/cjs/utils/parsers/hexToBytes.js +15 -0
  70. package/dist/cjs/utils/parsers/hexToBytes.js.map +1 -0
  71. package/dist/cjs/utils/parsers/index.d.ts +6 -0
  72. package/dist/cjs/utils/parsers/index.js +10 -0
  73. package/dist/cjs/utils/parsers/index.js.map +1 -0
  74. package/dist/cjs/utils/parsers/toBase64.d.ts +1 -0
  75. package/dist/cjs/utils/parsers/toBase64.js +11 -0
  76. package/dist/cjs/utils/parsers/toBase64.js.map +1 -0
  77. package/dist/cjs/utils/parsers/toHex.d.ts +1 -0
  78. package/dist/cjs/utils/parsers/toHex.js +8 -0
  79. package/dist/cjs/utils/parsers/toHex.js.map +1 -0
  80. package/dist/esm/api/generated-wallet-api.d.ts +417 -0
  81. package/dist/esm/api/generated-wallet-api.js +258 -0
  82. package/dist/esm/api/generated-wallet-api.js.map +1 -0
  83. package/dist/esm/constants/config.constants.d.ts +1 -0
  84. package/dist/esm/constants/config.constants.js +2 -0
  85. package/dist/esm/constants/config.constants.js.map +1 -0
  86. package/dist/esm/constants/index.d.ts +1 -0
  87. package/dist/esm/constants/index.js +2 -0
  88. package/dist/esm/constants/index.js.map +1 -0
  89. package/dist/esm/helpers/handleResponce.helper.d.ts +3 -0
  90. package/dist/esm/helpers/handleResponce.helper.js +21 -0
  91. package/dist/esm/helpers/handleResponce.helper.js.map +1 -0
  92. package/dist/esm/index.d.ts +19 -0
  93. package/dist/esm/index.js +10 -0
  94. package/dist/esm/index.js.map +1 -0
  95. package/dist/esm/requests/connect.d.ts +2 -0
  96. package/dist/esm/requests/connect.js +21 -0
  97. package/dist/esm/requests/connect.js.map +1 -0
  98. package/dist/esm/requests/getAccounts.d.ts +2 -0
  99. package/dist/esm/requests/getAccounts.js +19 -0
  100. package/dist/esm/requests/getAccounts.js.map +1 -0
  101. package/dist/esm/requests/getIsConnected.d.ts +2 -0
  102. package/dist/esm/requests/getIsConnected.js +19 -0
  103. package/dist/esm/requests/getIsConnected.js.map +1 -0
  104. package/dist/esm/requests/index.d.ts +5 -0
  105. package/dist/esm/requests/index.js +6 -0
  106. package/dist/esm/requests/index.js.map +1 -0
  107. package/dist/esm/requests/signMessage.d.ts +2 -0
  108. package/dist/esm/requests/signMessage.js +20 -0
  109. package/dist/esm/requests/signMessage.js.map +1 -0
  110. package/dist/esm/requests/signSend.d.ts +2 -0
  111. package/dist/esm/requests/signSend.js +20 -0
  112. package/dist/esm/requests/signSend.js.map +1 -0
  113. package/dist/esm/types/account.type.d.ts +7 -0
  114. package/dist/esm/types/account.type.js +2 -0
  115. package/dist/esm/types/account.type.js.map +1 -0
  116. package/dist/esm/types/communication.types.d.ts +19 -0
  117. package/dist/esm/types/communication.types.js +16 -0
  118. package/dist/esm/types/communication.types.js.map +1 -0
  119. package/dist/esm/types/connect.type.d.ts +8 -0
  120. package/dist/esm/types/connect.type.js +2 -0
  121. package/dist/esm/types/connect.type.js.map +1 -0
  122. package/dist/esm/types/index.d.ts +4 -0
  123. package/dist/esm/types/index.js +5 -0
  124. package/dist/esm/types/index.js.map +1 -0
  125. package/dist/esm/types/signed.type.d.ts +25 -0
  126. package/dist/esm/types/signed.type.js +2 -0
  127. package/dist/esm/types/signed.type.js.map +1 -0
  128. package/dist/esm/utils/checks/equalBytes.d.ts +1 -0
  129. package/dist/esm/utils/checks/equalBytes.js +6 -0
  130. package/dist/esm/utils/checks/equalBytes.js.map +1 -0
  131. package/dist/esm/utils/checks/index.d.ts +1 -0
  132. package/dist/esm/utils/checks/index.js +2 -0
  133. package/dist/esm/utils/checks/index.js.map +1 -0
  134. package/dist/esm/utils/index.d.ts +2 -0
  135. package/dist/esm/utils/index.js +3 -0
  136. package/dist/esm/utils/index.js.map +1 -0
  137. package/dist/esm/utils/parsers/base64ToBytes.d.ts +1 -0
  138. package/dist/esm/utils/parsers/base64ToBytes.js +5 -0
  139. package/dist/esm/utils/parsers/base64ToBytes.js.map +1 -0
  140. package/dist/esm/utils/parsers/base64toHex.d.ts +1 -0
  141. package/dist/esm/utils/parsers/base64toHex.js +7 -0
  142. package/dist/esm/utils/parsers/base64toHex.js.map +1 -0
  143. package/dist/esm/utils/parsers/hexToBase64.d.ts +1 -0
  144. package/dist/esm/utils/parsers/hexToBase64.js +9 -0
  145. package/dist/esm/utils/parsers/hexToBase64.js.map +1 -0
  146. package/dist/esm/utils/parsers/hexToBytes.d.ts +1 -0
  147. package/dist/esm/utils/parsers/hexToBytes.js +11 -0
  148. package/dist/esm/utils/parsers/hexToBytes.js.map +1 -0
  149. package/dist/esm/utils/parsers/index.d.ts +6 -0
  150. package/dist/esm/utils/parsers/index.js +7 -0
  151. package/dist/esm/utils/parsers/index.js.map +1 -0
  152. package/dist/esm/utils/parsers/toBase64.d.ts +1 -0
  153. package/dist/esm/utils/parsers/toBase64.js +7 -0
  154. package/dist/esm/utils/parsers/toBase64.js.map +1 -0
  155. package/dist/esm/utils/parsers/toHex.d.ts +1 -0
  156. package/dist/esm/utils/parsers/toHex.js +4 -0
  157. package/dist/esm/utils/parsers/toHex.js.map +1 -0
  158. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # 🧩 Console DApp SDK
2
+
3
+ > A lightweight SDK for connecting your Web3 applications to the **Console Wallet Extension** — enabling account access, connection status, message signing, and sending **Canton Coin** with ease.
4
+
5
+ ---
6
+
7
+ ## 🚀 Overview
8
+
9
+ **Console DApp SDK** is a developer-friendly library that allows any decentralized application (DApp) to seamlessly integrate with the **Console Wallet** browser extension.
10
+
11
+ It provides simple APIs to:
12
+
13
+ - 🔗 **Connect** your DApp to a user’s Console Wallet
14
+ - 👤 **Access** the active account and connection state
15
+ - ✍️ **Request message signing** to the wallet
16
+ - 💰 **Send Canton Coin** transactions securely and reliably
17
+
18
+ With just a few lines of code, you can authenticate users, sign data, or trigger Canton blockchain transactions — all through a unified SDK built for simplicity and safety.
19
+
20
+ ---
21
+
22
+ ## ⚙️ Key Features
23
+
24
+ | Feature | Description |
25
+ | -------------------------- | -------------------------------------------------------------- |
26
+ | 🔌 **Easy Integration** | One SDK import connects your app to Console Wallet instantly |
27
+ | 👛 **Account Access** | Retrieve connected account address and chain info |
28
+ | 🧾 **Message Signing** | Sign arbitrary messages or typed data directly from the wallet |
29
+ | 💸 **Transaction Support** | Send Canton Coin with a simple API call |
30
+ | 🔒 **Secure by Design** | Uses wallet’s native permissions and confirmation flows |
31
+ | 🧠 **Framework Agnostic** | Works with React, Vue, or vanilla JS apps |
32
+
33
+ ---
34
+
35
+ ## 🧠 Why Use Console DApp SDK?
36
+
37
+ Instead of manually handling RPC connections or building custom wallet logic, `console-wallet-dapp-templ` provides a **clean, unified interface** for interacting with the Canton ecosystem.
38
+
39
+ It’s ideal for:
40
+
41
+ - Light start with Canton blockchain
42
+ - Web3 DApps that need wallet connection and signing
43
+ - Any app that interacts with Canton
44
+
45
+ ---
46
+
47
+ ## 🧠 Core Functionality
48
+
49
+ The **Console DApp SDK** provides a communication layer between your Web3 application and the **Console Wallet Extension** using the browser’s native `window.postMessage` API.
50
+
51
+ It handles all low-level messaging logic automatically, so you can focus on building your DApp — not managing communication details.
52
+
53
+ ### 🔄 How It Works
54
+
55
+ 1. When your DApp sends a request (e.g., `connect()`, `signMessage()`, or `sendTransaction()`),
56
+ the SDK transmits a structured message to the **Console Wallet Extension** via `window.postMessage`.
57
+
58
+ 2. Each outgoing request is assigned a **unique request ID**, which is included in both the request and the extension’s response.
59
+
60
+ 3. The SDK listens for incoming responses from the extension, matches them to their original request using the ID,
61
+ and automatically resolves the corresponding Promise in your application.
62
+
63
+ This approach ensures **reliable, asynchronous communication** between the DApp and the extension — preventing race conditions, mismatched responses, or orphaned message handlers.
64
+
65
+ ### 🧩 Benefits
66
+
67
+ - ✅ Fully **type-safe and asynchronous** API
68
+ - 🧭 No manual message listeners required
69
+ - 🛡️ Prevents **response mismatch errors** with per-request unique IDs
70
+ - ⚡ Lightweight and dependency-free
71
+ - 🧠 Extensible for future Console Wallet capabilities (multi-chain support, session management, etc.)
72
+
73
+ ---
74
+
75
+ > In short: the SDK abstracts all the complex message passing between your DApp and the wallet, providing a **stable and predictable communication layer** out of the box.
76
+
77
+ ## 📡 Supported Requests
78
+
79
+ The SDK exposes several high-level request methods that communicate with the **Console Wallet Extension** through secure message passing.
80
+ Each request is automatically tagged with a **unique request ID** to ensure reliable response matching.
81
+
82
+ | Method | Description | Request Payload | Response |
83
+ | ---------------------- | -------------------------------------------------------------- | --------------------------------- | ----------------------- |
84
+ | `getAccounts()` | Retrieves the currently connected wallet account(s). | — | `GetAccountsResponse` |
85
+ | `signMessage(message)` | Requests the user to sign a message in hex or base 64 format. | `{ message: SignMessageRequest }` | `SignedMessageResponse` |
86
+ | `signSend(data)` | Signs and broadcasts a transaction to send **Canton Coin**. | `SignSendRequest` | `SignSendResponse` |
87
+ | `connect(data)` | Prompts the users to connect their Console Wallet to the DApp. | `ConnectRequest` | `boolean` |
88
+ | `getIsConnected()` | Checks if the DApp is already connected to the wallet. | — | `boolean` |
89
+
90
+ ---
91
+
92
+ ### 🪄 Example
93
+
94
+ ```js
95
+ const handleSignSend = async () => {
96
+ if (!amount || !receiver || !expireDate) {
97
+ alert('Please fill all fields');
98
+ return;
99
+ }
100
+
101
+ try {
102
+ const activeAccount = await consoleWalletPixelplex.getAccounts();
103
+ const signResult = await consoleWalletPixelplex.signSend({
104
+ to: receiver,
105
+ from: activeAccount?.[0].party || '',
106
+ amount,
107
+ expireDate,
108
+ });
109
+
110
+ setResult(signResult.status ? 'Transaction signed successfully' : 'Transaction error');
111
+ } catch (error) {
112
+ console.error('Error signing transaction:', error);
113
+ setResult('Error signing transaction');
114
+ }
115
+ };
116
+ ```
117
+
118
+ ## 📦 Installation
119
+
120
+ ```bash
121
+ npm install console-wallet-dapp-templ
122
+ # or
123
+ yarn add console-wallet-dapp-templ
124
+
125
+ ```
126
+
127
+ Before your DApp can interact with the **Console Wallet Extension**, it needs to **initialize a connection session**.
128
+ This step establishes secure communication between your web application and the user’s wallet.
129
+
130
+ ### 🔌 Connecting Your DApp
131
+
132
+ The SDK provides a simple `connect()` method that requests permission from the user’s Console Wallet.
133
+
134
+ ```js
135
+ import { consoleWalletPixelplex } from 'console-wallet-dapp-templ';
136
+
137
+ const handleConnect = async () => {
138
+ try {
139
+ await consoleWalletPixelplex.connect({ name, icon });
140
+ } catch (error) {
141
+ console.error('Error checking connection:', error);
142
+ }
143
+ };
144
+
145
+ const handleCheckConnection = async () => {
146
+ try {
147
+ const isConnected = await consoleWalletPixelplex.getIsConnected();
148
+ setConnectionStatus(isConnected ? 'Connected' : 'Not connected');
149
+ } catch (error) {
150
+ console.error('Error checking connection:', error);
151
+ }
152
+ };
153
+ ```
@@ -0,0 +1,417 @@
1
+ export interface AllocationSummaryDTO {
2
+ allocate_before: string;
3
+ amount: string;
4
+ contract_id: string;
5
+ event_id: string;
6
+ executor: string;
7
+ receiver: string;
8
+ sender: string;
9
+ settle_before: string;
10
+ status: string;
11
+ }
12
+ export interface AmuletDTO {
13
+ amulet_balance: string;
14
+ locked_amulet_balance: string;
15
+ }
16
+ export interface BalanceDTO {
17
+ accumulated_holding_fees_locked: string;
18
+ accumulated_holding_fees_total: string;
19
+ accumulated_holding_fees_unlocked: string;
20
+ computed_as_of_round: number;
21
+ computed_as_of_time: string;
22
+ party_id: string;
23
+ total_available_coin: string;
24
+ total_coin_holdings: string;
25
+ total_locked_coin: string;
26
+ total_unlocked_coin: string;
27
+ }
28
+ export interface CreateTapDTO {
29
+ amount: string;
30
+ partyId: string;
31
+ privateKey: string;
32
+ }
33
+ export interface GetOffersSearchResponseDTO {
34
+ data: OfferDTO[];
35
+ next_cursor: string | null;
36
+ }
37
+ export interface GetPartyDetailsResponseDTO {
38
+ amulets: AmuletDTO;
39
+ balance: BalanceDTO;
40
+ in_pending_offers_count: number;
41
+ out_pending_offers_count: number;
42
+ party_id: string;
43
+ total_merge_split_burn_fee: string;
44
+ total_merge_split_count: number;
45
+ total_transfer_allocation_count: number;
46
+ total_transfer_allocation_count_as_receiver: number;
47
+ total_transfer_allocation_count_as_sender: number;
48
+ total_transfer_burn_fee: string;
49
+ total_transfer_command_count: number;
50
+ total_transfer_command_count_as_receiver: number;
51
+ total_transfer_command_count_as_sender: number;
52
+ total_transfer_count_as_receiver: number;
53
+ total_transfer_count_as_sender: number;
54
+ total_transfer_instruction_count: number;
55
+ total_transfer_instruction_count_as_receiver: number;
56
+ total_transfer_instruction_count_as_sender: number;
57
+ total_transfers_count: number;
58
+ validator_license: ValidatorLicenseDTO;
59
+ }
60
+ export interface GetPendingTransactionsResponseDTO {
61
+ items: object[];
62
+ }
63
+ export interface GetPricesResponseDTO {
64
+ current: string | null;
65
+ one_day_ago: string | null;
66
+ one_month_ago: string | null;
67
+ one_week_ago: string | null;
68
+ one_year_ago: string | null;
69
+ start_of_day: string | null;
70
+ }
71
+ export interface GetTokenTransfersByPartyResponseDTO {
72
+ data: TokenTransferItemDTO[];
73
+ next_cursor: string | null;
74
+ }
75
+ export interface GetTransferDetailsResponseDTO {
76
+ data: TransferAllocationResponseDTO | TransferInstructionResponseDTO | TransferPreApprovedInstructionResponseDTO | TransferOtherResponseDTO;
77
+ }
78
+ export interface InstructionSummaryDTO {
79
+ amount: string;
80
+ contract_id: string | null;
81
+ event_id: string;
82
+ execute_before: string;
83
+ executed_at: string | null;
84
+ receiver: string;
85
+ sender: string;
86
+ status: string;
87
+ }
88
+ export interface ListUtxosResponseDTO {
89
+ utxos: string[];
90
+ }
91
+ export interface MetadataDTO {
92
+ 'splice.lfdecentralizedtrust.org/burned': string;
93
+ 'splice.lfdecentralizedtrust.org/sender': string;
94
+ 'splice.lfdecentralizedtrust.org/tx-kind': string;
95
+ }
96
+ export interface OfferDTO {
97
+ amount: string;
98
+ contract_id: string | null;
99
+ event_id: string;
100
+ offer_type: string;
101
+ receiver_party_id: string;
102
+ record_time: string;
103
+ sender_party_id: string;
104
+ status: string;
105
+ }
106
+ export interface PrepareExternalPartyBodyDTO {
107
+ partyHint?: string;
108
+ publicKey: string;
109
+ }
110
+ export interface PrepareExternalPartyResponseDTO {
111
+ preparedParty: PreparedExternalPartyResponseDTO;
112
+ }
113
+ export interface PrepareResolveTransferBodyDTO {
114
+ choice: 'Accept' | 'Reject' | 'Withdraw';
115
+ partyId: string;
116
+ transferCid: string;
117
+ }
118
+ export interface PrepareResolveTransferResponseDTO {
119
+ preparedSubmission: PreparedSubmissionResponseDTO;
120
+ submissionId: string;
121
+ }
122
+ export interface PrepareTransferBodyDTO {
123
+ amount: string;
124
+ /** @format date-time */
125
+ expiryDate: string;
126
+ receiver: string;
127
+ sender: string;
128
+ }
129
+ export interface PrepareTransferResponseDTO {
130
+ hashingDetails: string;
131
+ hashingSchemeVersion: string;
132
+ preparedTransaction: string;
133
+ preparedTransactionHash: string;
134
+ submissionId: string;
135
+ }
136
+ export interface PreparedExternalPartyBodyDTO {
137
+ combinedHash: string;
138
+ namespace: string;
139
+ partyId: string;
140
+ partyTransactions: string[];
141
+ txHashes: string[];
142
+ }
143
+ export interface PreparedExternalPartyResponseDTO {
144
+ combinedHash: string;
145
+ namespace: string;
146
+ partyId: string;
147
+ partyTransactions: string[];
148
+ txHashes: string[];
149
+ }
150
+ export interface PreparedSubmissionBodyDTO {
151
+ hashingDetails: string | null;
152
+ hashingSchemeVersion: string;
153
+ preparedTransaction: string;
154
+ preparedTransactionHash: string;
155
+ }
156
+ export interface PreparedSubmissionResponseDTO {
157
+ hashingDetails: string;
158
+ hashingSchemeVersion: string;
159
+ preparedTransaction: string;
160
+ preparedTransactionHash: string;
161
+ }
162
+ export interface ProxyRequestDTO {
163
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
164
+ path: string;
165
+ pathTemplate: '/explore/prices' | '/offers/search' | '/parties/{party_id}' | '/token-transfers/by-party' | '/api/v1/token-transfers/{event_id}';
166
+ payload?: string;
167
+ }
168
+ export interface SpentDTO {
169
+ receivers: SpentReceiverItemDTO[];
170
+ sender_send: string;
171
+ total_change_fee: string;
172
+ total_fee: string;
173
+ total_holder_fee: string;
174
+ total_output_fee: string;
175
+ }
176
+ export interface SpentReceiverItemDTO {
177
+ amount: string;
178
+ receiver: string;
179
+ }
180
+ export interface SubmitExternalPartyBodyDTO {
181
+ preparedParty: PreparedExternalPartyBodyDTO;
182
+ signedHash: string;
183
+ }
184
+ export interface SubmitExternalPartyResponseDTO {
185
+ partyId: string;
186
+ }
187
+ export interface SubmitResolveTransferBodyDTO {
188
+ preparedSubmission: PreparedSubmissionBodyDTO;
189
+ publicKey: string;
190
+ signature: string;
191
+ submissionId: string;
192
+ }
193
+ export interface SubmitTransferBodyDTO {
194
+ preparedTransfer: PrepareTransferResponseDTO;
195
+ publicKey: string;
196
+ signature: string;
197
+ }
198
+ export interface TokenTransferDataDTO {
199
+ holding_fee: string;
200
+ input_amount: string;
201
+ metadata: MetadataDTO;
202
+ provider: string;
203
+ receivers: TransferDataReceiversDTO;
204
+ round: number;
205
+ sender: string;
206
+ sender_change_amount: string;
207
+ sender_change_fee: string;
208
+ }
209
+ export interface TokenTransferItemDTO {
210
+ event_id: string;
211
+ record_time: string;
212
+ spent: SpentDTO;
213
+ transfer_data: TokenTransferDataDTO;
214
+ transfer_type: string;
215
+ }
216
+ export interface TrafficStatusDTO {
217
+ last_updated: string | null;
218
+ total_consumed: number;
219
+ total_limit: number;
220
+ total_purchased: number;
221
+ usage_percent: number;
222
+ }
223
+ export interface TransferAllocationDTO {
224
+ first_step: TransferStepDTO;
225
+ second_step: TransferStepDTO | null;
226
+ spent: SpentDTO;
227
+ summary: AllocationSummaryDTO;
228
+ }
229
+ export interface TransferAllocationResponseDTO {
230
+ allocation: TransferAllocationDTO;
231
+ }
232
+ export type TransferDataReceiversDTO = object;
233
+ export interface TransferInstructionDTO {
234
+ first_step: TransferStepDTO;
235
+ second_step: TransferStepDTO | null;
236
+ spent: SpentDTO;
237
+ summary: InstructionSummaryDTO;
238
+ }
239
+ export interface TransferInstructionResponseDTO {
240
+ instruction: TransferInstructionDTO;
241
+ }
242
+ export interface TransferOtherDTO {
243
+ finalized_step: TransferStepDTO;
244
+ spent: SpentDTO;
245
+ }
246
+ export interface TransferOtherResponseDTO {
247
+ other: TransferOtherDTO;
248
+ }
249
+ export interface TransferPreApprovedInstructionDTO {
250
+ finalized_step: TransferStepDTO;
251
+ spent: SpentDTO;
252
+ summary: InstructionSummaryDTO;
253
+ }
254
+ export interface TransferPreApprovedInstructionResponseDTO {
255
+ preapproved_instruction: TransferPreApprovedInstructionDTO;
256
+ }
257
+ export interface TransferStepDTO {
258
+ event_id: string;
259
+ record_time: string;
260
+ transfer_data: TokenTransferDataDTO;
261
+ transfer_type: string;
262
+ update_id: string;
263
+ }
264
+ export interface ValidatorLicenseDTO {
265
+ active: boolean;
266
+ amulet_balance: string;
267
+ contact: string | null;
268
+ contract_id: string;
269
+ dso: string;
270
+ first_round: number;
271
+ last_active_at: string | null;
272
+ last_round: number;
273
+ metadata_last_update: string | null;
274
+ miss_round: number;
275
+ participated_updates_count: number;
276
+ sponsor: string;
277
+ template_id: string;
278
+ traffic_status: TrafficStatusDTO;
279
+ transfers_count: number;
280
+ validator_id: string;
281
+ version: string | null;
282
+ }
283
+ import type { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios';
284
+ export type QueryParamsType = Record<string | number, any>;
285
+ export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
286
+ /** set parameter to `true` for call `securityWorker` for this request */
287
+ secure?: boolean;
288
+ /** request path */
289
+ path: string;
290
+ /** content type of request body */
291
+ type?: ContentType;
292
+ /** query params */
293
+ query?: QueryParamsType;
294
+ /** format of response (i.e. response.json() -> format: "json") */
295
+ format?: ResponseType;
296
+ /** request body */
297
+ body?: unknown;
298
+ }
299
+ export type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
300
+ export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
301
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
302
+ secure?: boolean;
303
+ format?: ResponseType;
304
+ }
305
+ export declare enum ContentType {
306
+ Json = "application/json",
307
+ JsonApi = "application/vnd.api+json",
308
+ FormData = "multipart/form-data",
309
+ UrlEncoded = "application/x-www-form-urlencoded",
310
+ Text = "text/plain"
311
+ }
312
+ export declare class HttpClient<SecurityDataType = unknown> {
313
+ instance: AxiosInstance;
314
+ private securityData;
315
+ private securityWorker?;
316
+ private secure?;
317
+ private format?;
318
+ constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
319
+ setSecurityData: (data: SecurityDataType | null) => void;
320
+ protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
321
+ protected stringifyFormItem(formItem: unknown): string;
322
+ protected createFormData(input: Record<string, unknown>): FormData;
323
+ request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<T>;
324
+ }
325
+ /**
326
+ * @title 869-wallet-extension-backend
327
+ * @version 0.0.1
328
+ * @contact
329
+ */
330
+ export declare class WalletApi<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
331
+ api: {
332
+ /**
333
+ * No description
334
+ *
335
+ * @tags external-party
336
+ * @name ExternalPartyControllerPrepareExternalParty
337
+ * @request POST:/api/v1/external-party/prepare
338
+ */
339
+ externalPartyControllerPrepareExternalParty: (data: PrepareExternalPartyBodyDTO, params?: RequestParams) => Promise<PrepareExternalPartyResponseDTO>;
340
+ /**
341
+ * No description
342
+ *
343
+ * @tags external-party
344
+ * @name ExternalPartyControllerSubmitExternalParty
345
+ * @request POST:/api/v1/external-party/submit
346
+ */
347
+ externalPartyControllerSubmitExternalParty: (data: SubmitExternalPartyBodyDTO, params?: RequestParams) => Promise<SubmitExternalPartyResponseDTO>;
348
+ /**
349
+ * No description
350
+ *
351
+ * @tags proxy
352
+ * @name ProxyIndexerControllerProxy
353
+ * @request POST:/api/v1/proxy/indexer
354
+ */
355
+ proxyIndexerControllerProxy: (data: ProxyRequestDTO, params?: RequestParams) => Promise<GetOffersSearchResponseDTO | GetPartyDetailsResponseDTO | GetPricesResponseDTO | GetTokenTransfersByPartyResponseDTO | GetTransferDetailsResponseDTO>;
356
+ /**
357
+ * No description
358
+ *
359
+ * @tags token-standard
360
+ * @name TokenStandardControllerCreateTap
361
+ * @request POST:/api/v1/token-standard/tap
362
+ */
363
+ tokenStandardControllerCreateTap: (data: CreateTapDTO, params?: RequestParams) => Promise<void>;
364
+ /**
365
+ * No description
366
+ *
367
+ * @tags token-standard
368
+ * @name TokenStandardControllerGetPendingTransactions
369
+ * @request GET:/api/v1/token-standard/transactions/pending
370
+ */
371
+ tokenStandardControllerGetPendingTransactions: (query: {
372
+ partyId: string;
373
+ }, params?: RequestParams) => Promise<GetPendingTransactionsResponseDTO>;
374
+ /**
375
+ * No description
376
+ *
377
+ * @tags token-standard
378
+ * @name TokenStandardControllerListUtxoHoldings
379
+ * @request GET:/api/v1/token-standard/utxo-holdings
380
+ */
381
+ tokenStandardControllerListUtxoHoldings: (query: {
382
+ partyId: string;
383
+ }, params?: RequestParams) => Promise<ListUtxosResponseDTO>;
384
+ /**
385
+ * No description
386
+ *
387
+ * @tags token-standard
388
+ * @name TransferControllerPrepareResolveTransfer
389
+ * @request POST:/api/v1/token-standard/transfer/resolve/prepare
390
+ */
391
+ transferControllerPrepareResolveTransfer: (data: PrepareResolveTransferBodyDTO, params?: RequestParams) => Promise<PrepareResolveTransferResponseDTO>;
392
+ /**
393
+ * No description
394
+ *
395
+ * @tags token-standard
396
+ * @name TransferControllerPrepareTransfer
397
+ * @request POST:/api/v1/token-standard/transfer/prepare
398
+ */
399
+ transferControllerPrepareTransfer: (data: PrepareTransferBodyDTO, params?: RequestParams) => Promise<PrepareTransferResponseDTO>;
400
+ /**
401
+ * No description
402
+ *
403
+ * @tags token-standard
404
+ * @name TransferControllerSubmitResolveTransfer
405
+ * @request POST:/api/v1/token-standard/transfer/resolve/submit
406
+ */
407
+ transferControllerSubmitResolveTransfer: (data: SubmitResolveTransferBodyDTO, params?: RequestParams) => Promise<void>;
408
+ /**
409
+ * No description
410
+ *
411
+ * @tags token-standard
412
+ * @name TransferControllerSubmitTransfer
413
+ * @request POST:/api/v1/token-standard/transfer/submit
414
+ */
415
+ transferControllerSubmitTransfer: (data: SubmitTransferBodyDTO, params?: RequestParams) => Promise<void>;
416
+ };
417
+ }