@subwallet/extension-base 1.3.31-1 → 1.3.32-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +70 -3
- package/background/KoniTypes.js +14 -0
- package/background/errors/CardanoProviderError.d.ts +6 -0
- package/background/errors/CardanoProviderError.js +61 -0
- package/background/types.d.ts +2 -2
- package/cjs/background/KoniTypes.js +16 -1
- package/cjs/background/errors/CardanoProviderError.js +67 -0
- package/cjs/constants/index.js +4 -1
- package/cjs/core/logic-validation/request.js +50 -3
- package/cjs/koni/api/contract-handler/evm/web3.js +21 -0
- package/cjs/koni/api/staking/bonding/utils.js +24 -3
- package/cjs/koni/background/handlers/Extension.js +115 -107
- package/cjs/koni/background/handlers/State.js +228 -5
- package/cjs/koni/background/handlers/Tabs.js +277 -55
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/cardano/cips/cip30.js +63 -0
- package/cjs/page/cardano/cips/index.js +20 -0
- package/cjs/page/cardano/index.js +41 -0
- package/cjs/page/{SubWalleEvmProvider.js → evm/index.js} +2 -2
- package/cjs/page/index.js +9 -4
- package/cjs/services/balance-service/transfer/xcm/acrossBridge/index.js +6 -2
- package/cjs/services/balance-service/transfer/xcm/index.js +2 -0
- package/cjs/services/chain-service/handler/CardanoApi.js +33 -0
- package/cjs/services/chain-service/index.js +31 -0
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +3 -3
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +42 -8
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/tao.js +13 -13
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateAuthUrls.js +1 -1
- package/cjs/services/request-service/constants.js +3 -1
- package/cjs/services/request-service/handler/AuthRequestHandler.js +38 -5
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +45 -3
- package/cjs/services/request-service/helper/index.js +419 -1
- package/cjs/services/swap-service/handler/asset-hub/handler.js +1 -1
- package/cjs/services/swap-service/handler/base-handler.js +81 -21
- package/cjs/services/swap-service/handler/hydradx-handler.js +1 -1
- package/cjs/services/swap-service/handler/uniswap-handler.js +274 -45
- package/cjs/services/swap-service/index.js +33 -11
- package/cjs/services/swap-service/utils.js +15 -2
- package/cjs/utils/auth.js +2 -1
- package/cjs/utils/cardano.js +20 -0
- package/cjs/utils/index.js +4 -4
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/core/logic-validation/request.d.ts +6 -2
- package/core/logic-validation/request.js +51 -5
- package/koni/api/contract-handler/evm/web3.d.ts +2 -0
- package/koni/api/contract-handler/evm/web3.js +19 -0
- package/koni/api/staking/bonding/utils.d.ts +2 -1
- package/koni/api/staking/bonding/utils.js +23 -3
- package/koni/background/handlers/Extension.js +7 -2
- package/koni/background/handlers/State.d.ts +6 -1
- package/koni/background/handlers/State.js +223 -4
- package/koni/background/handlers/Tabs.d.ts +11 -1
- package/koni/background/handlers/Tabs.js +242 -19
- package/package.json +62 -42
- package/packageInfo.js +1 -1
- package/page/cardano/cips/cip30.d.ts +22 -0
- package/page/cardano/cips/cip30.js +55 -0
- package/page/cardano/cips/index.d.ts +3 -0
- package/page/cardano/cips/index.js +7 -0
- package/page/cardano/index.d.ts +13 -0
- package/page/cardano/index.js +34 -0
- package/page/{SubWalleEvmProvider.d.ts → evm/index.d.ts} +3 -2
- package/page/{SubWalleEvmProvider.js → evm/index.js} +1 -1
- package/page/index.d.ts +3 -2
- package/page/index.js +6 -2
- package/page/{Accounts.d.ts → substrate/Accounts.d.ts} +1 -1
- package/page/{Metadata.d.ts → substrate/Metadata.d.ts} +1 -1
- package/page/{PostMessageProvider.d.ts → substrate/PostMessageProvider.d.ts} +1 -1
- package/page/{Signer.d.ts → substrate/Signer.d.ts} +1 -1
- package/page/{Injected.d.ts → substrate/index.d.ts} +1 -1
- package/services/balance-service/helpers/subscribe/cardano/types.d.ts +14 -0
- package/services/balance-service/transfer/xcm/acrossBridge/index.d.ts +4 -0
- package/services/balance-service/transfer/xcm/acrossBridge/index.js +4 -1
- package/services/balance-service/transfer/xcm/index.js +2 -0
- package/services/chain-service/handler/CardanoApi.d.ts +3 -1
- package/services/chain-service/handler/CardanoApi.js +33 -0
- package/services/chain-service/index.d.ts +5 -1
- package/services/chain-service/index.js +32 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +3 -3
- package/services/earning-service/handlers/native-staking/dtao.js +2 -2
- package/services/earning-service/handlers/native-staking/mythos.js +42 -8
- package/services/earning-service/handlers/native-staking/relay-chain.js +1 -1
- package/services/earning-service/handlers/native-staking/tao.js +14 -14
- package/services/earning-service/handlers/nomination-pool/index.js +1 -1
- package/services/migration-service/scripts/MigrateAuthUrls.js +1 -1
- package/services/request-service/constants.js +3 -1
- package/services/request-service/handler/AuthRequestHandler.js +40 -7
- package/services/request-service/handler/CardanoRequestHandler.d.ts +2 -0
- package/services/request-service/handler/CardanoRequestHandler.js +45 -3
- package/services/request-service/helper/index.d.ts +54 -0
- package/services/request-service/helper/index.js +406 -1
- package/services/request-service/types.d.ts +3 -1
- package/services/swap-service/handler/asset-hub/handler.js +1 -1
- package/services/swap-service/handler/base-handler.d.ts +3 -1
- package/services/swap-service/handler/base-handler.js +82 -22
- package/services/swap-service/handler/hydradx-handler.js +1 -1
- package/services/swap-service/handler/uniswap-handler.d.ts +5 -0
- package/services/swap-service/handler/uniswap-handler.js +275 -46
- package/services/swap-service/index.js +34 -12
- package/services/swap-service/utils.d.ts +3 -2
- package/services/swap-service/utils.js +13 -1
- package/types/swap/index.d.ts +1 -0
- package/types/transaction/process.d.ts +2 -0
- package/utils/auth.js +3 -2
- package/utils/cardano.d.ts +2 -0
- package/utils/cardano.js +12 -0
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/cjs/utils/canDerive.js +0 -12
- package/utils/canDerive.d.ts +0 -2
- package/utils/canDerive.js +0 -6
- /package/cjs/page/{Accounts.js → substrate/Accounts.js} +0 -0
- /package/cjs/page/{Metadata.js → substrate/Metadata.js} +0 -0
- /package/cjs/page/{PostMessageProvider.js → substrate/PostMessageProvider.js} +0 -0
- /package/cjs/page/{Signer.js → substrate/Signer.js} +0 -0
- /package/cjs/page/{Injected.js → substrate/index.js} +0 -0
- /package/page/{Accounts.js → substrate/Accounts.js} +0 -0
- /package/page/{Metadata.js → substrate/Metadata.js} +0 -0
- /package/page/{PostMessageProvider.js → substrate/PostMessageProvider.js} +0 -0
- /package/page/{Signer.js → substrate/Signer.js} +0 -0
- /package/page/{Injected.js → substrate/index.js} +0 -0
|
@@ -5,7 +5,9 @@ export const EXTENSION_REQUEST_URL = 'extension';
|
|
|
5
5
|
export const PREDEFINED_CHAIN_DAPP_CHAIN_MAP = {
|
|
6
6
|
'portal.astar.network': ['astar', 'astarEvm'],
|
|
7
7
|
'apps.moonbeam.network': ['moonbeam', 'moonriver'],
|
|
8
|
-
'app.stellaswap.com': ['moonbeam']
|
|
8
|
+
'app.stellaswap.com': ['moonbeam'],
|
|
9
|
+
'testnet-preprod.minswap.org': ['cardano_preproduction'],
|
|
10
|
+
'localhost:7777': ['cardano_preproduction']
|
|
9
11
|
};
|
|
10
12
|
export const WEB_APP_URL = [
|
|
11
13
|
/// Web app
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { ALL_ACCOUNT_AUTH_TYPES } from '@subwallet/extension-base/constants';
|
|
5
|
-
import { _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
5
|
+
import { _isChainCardanoCompatible, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
6
|
import { DAPP_CONNECT_BOTH_TYPE_ACCOUNT_URL, PREDEFINED_CHAIN_DAPP_CHAIN_MAP, WEB_APP_URL } from '@subwallet/extension-base/services/request-service/constants';
|
|
7
7
|
import AuthorizeStore from '@subwallet/extension-base/stores/Authorize';
|
|
8
8
|
import { createPromiseHandler, getDomainFromUrl, stripUrl } from '@subwallet/extension-base/utils';
|
|
9
9
|
import { getId } from '@subwallet/extension-base/utils/getId';
|
|
10
|
-
import { isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
|
|
10
|
+
import { isCardanoAddress, isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
|
|
11
11
|
import { BehaviorSubject } from 'rxjs';
|
|
12
12
|
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
13
13
|
const AUTH_URLS_KEY = 'authUrls';
|
|
@@ -37,6 +37,13 @@ export default class AuthRequestHandler {
|
|
|
37
37
|
value.accountAuthTypes = ['evm', 'substrate'];
|
|
38
38
|
needUpdateAuthList = true;
|
|
39
39
|
}
|
|
40
|
+
const existKeyEvmNetworkConnect = value.currentEvmNetworkKey;
|
|
41
|
+
if (existKeyEvmNetworkConnect) {
|
|
42
|
+
value.currentNetworkMap = {
|
|
43
|
+
evm: existKeyEvmNetworkConnect
|
|
44
|
+
};
|
|
45
|
+
needUpdateAuthList = true;
|
|
46
|
+
}
|
|
40
47
|
acc[key] = {
|
|
41
48
|
...value
|
|
42
49
|
};
|
|
@@ -145,6 +152,18 @@ export default class AuthRequestHandler {
|
|
|
145
152
|
}
|
|
146
153
|
}
|
|
147
154
|
}
|
|
155
|
+
if (options.accessType === 'cardano') {
|
|
156
|
+
const cardanoChains = Object.values(chainInfoMaps).filter(_isChainCardanoCompatible);
|
|
157
|
+
chainInfo = (defaultChain ? chainInfoMaps[defaultChain] : chainInfoMaps.cardano) || cardanoChains[0]; // auto active cardano mainnet chain, because dont support switch network yet
|
|
158
|
+
|
|
159
|
+
if (options.autoActive) {
|
|
160
|
+
var _chainInfo3;
|
|
161
|
+
if (!needEnableChains.includes((_chainInfo3 = chainInfo) === null || _chainInfo3 === void 0 ? void 0 : _chainInfo3.slug)) {
|
|
162
|
+
var _chainInfo4;
|
|
163
|
+
needEnableChains.push((_chainInfo4 = chainInfo) === null || _chainInfo4 === void 0 ? void 0 : _chainInfo4.slug);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
148
167
|
needEnableChains = needEnableChains.filter(slug => {
|
|
149
168
|
var _chainStateMap$slug;
|
|
150
169
|
return !((_chainStateMap$slug = chainStateMap[slug]) !== null && _chainStateMap$slug !== void 0 && _chainStateMap$slug.active);
|
|
@@ -193,20 +212,31 @@ export default class AuthRequestHandler {
|
|
|
193
212
|
if (isTonAddress(a) && !accountAuthTypes.includes('ton')) {
|
|
194
213
|
return true;
|
|
195
214
|
}
|
|
215
|
+
if (isCardanoAddress(a) && !accountAuthTypes.includes('cardano')) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
196
218
|
return false;
|
|
197
219
|
});
|
|
198
220
|
backupAllowed.forEach(acc => {
|
|
199
221
|
isAllowedMap[acc] = true;
|
|
200
222
|
});
|
|
201
223
|
}
|
|
202
|
-
|
|
224
|
+
const defaultNetworkMap = {};
|
|
203
225
|
if (accountAuthTypes.includes('evm')) {
|
|
204
226
|
const chainInfo = this.getDAppChainInfo({
|
|
205
227
|
accessType: 'evm',
|
|
206
228
|
autoActive: true,
|
|
207
229
|
url
|
|
208
230
|
});
|
|
209
|
-
|
|
231
|
+
defaultNetworkMap.evm = chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.slug;
|
|
232
|
+
}
|
|
233
|
+
if (accountAuthTypes.includes('cardano')) {
|
|
234
|
+
const chainInfo = this.getDAppChainInfo({
|
|
235
|
+
accessType: 'cardano',
|
|
236
|
+
autoActive: true,
|
|
237
|
+
url
|
|
238
|
+
});
|
|
239
|
+
defaultNetworkMap.cardano = chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.slug;
|
|
210
240
|
}
|
|
211
241
|
this.getAuthorize(value => {
|
|
212
242
|
let authorizeList = {};
|
|
@@ -230,7 +260,7 @@ export default class AuthRequestHandler {
|
|
|
230
260
|
origin,
|
|
231
261
|
url,
|
|
232
262
|
accountAuthTypes: [...new Set([...accountAuthTypes, ...((existed === null || existed === void 0 ? void 0 : existed.accountAuthTypes) || [])])],
|
|
233
|
-
|
|
263
|
+
currentNetworkMap: existed ? existed.currentNetworkMap : defaultNetworkMap
|
|
234
264
|
};
|
|
235
265
|
this.setAuthorize(authorizeList, () => {
|
|
236
266
|
cb();
|
|
@@ -328,12 +358,14 @@ export default class AuthRequestHandler {
|
|
|
328
358
|
list.push(...allowedListByRequestType.filter(a => isSubstrateAddress(a)));
|
|
329
359
|
} else if (accountAuthType === 'ton') {
|
|
330
360
|
list.push(...allowedListByRequestType.filter(a => isTonAddress(a)));
|
|
361
|
+
} else if (accountAuthType === 'cardano') {
|
|
362
|
+
list.push(...allowedListByRequestType.filter(a => isCardanoAddress(a)));
|
|
331
363
|
}
|
|
332
364
|
return list;
|
|
333
365
|
}, []);
|
|
334
366
|
if (!confirmAnotherType && !request.reConfirm && allowedListByRequestType.length !== 0) {
|
|
335
367
|
// Prevent appear confirmation popup
|
|
336
|
-
return
|
|
368
|
+
return true;
|
|
337
369
|
}
|
|
338
370
|
} else {
|
|
339
371
|
// Auto auth for web app
|
|
@@ -349,7 +381,8 @@ export default class AuthRequestHandler {
|
|
|
349
381
|
isAllowedMap,
|
|
350
382
|
origin,
|
|
351
383
|
url,
|
|
352
|
-
accountAuthTypes: ALL_ACCOUNT_AUTH_TYPES
|
|
384
|
+
accountAuthTypes: ALL_ACCOUNT_AUTH_TYPES,
|
|
385
|
+
currentNetworkMap: {}
|
|
353
386
|
};
|
|
354
387
|
this.setAuthorize(authList);
|
|
355
388
|
return true;
|
|
@@ -11,6 +11,8 @@ export default class CardanoRequestHandler {
|
|
|
11
11
|
addConfirmationCardano<CT extends ConfirmationTypeCardano>(id: string, url: string, type: CT, payload: ConfirmationDefinitionsCardano[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitionsCardano[CT][1]) => Error | undefined): Promise<ConfirmationDefinitionsCardano[CT][1]>;
|
|
12
12
|
completeConfirmationCardano(request: RequestConfirmationCompleteCardano): Promise<boolean>;
|
|
13
13
|
private decorateResult;
|
|
14
|
+
private signMessage;
|
|
14
15
|
private signTransactionCardano;
|
|
16
|
+
private signDappTransactionCardano;
|
|
15
17
|
resetWallet(): void;
|
|
16
18
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { FixedTransaction, TransactionWitnessSet, Vkeywitnesses } from '@emurgo/cardano-serialization-lib-nodejs';
|
|
4
5
|
import { isInternalRequest } from '@subwallet/extension-base/utils/request';
|
|
5
6
|
import { keyring } from '@subwallet/ui-keyring';
|
|
6
7
|
import { t } from 'i18next';
|
|
@@ -12,7 +13,8 @@ export default class CardanoRequestHandler {
|
|
|
12
13
|
confirmationsQueueSubjectCardano = new BehaviorSubject({
|
|
13
14
|
cardanoSignatureRequest: {},
|
|
14
15
|
cardanoSendTransactionRequest: {},
|
|
15
|
-
cardanoWatchTransactionRequest: {}
|
|
16
|
+
cardanoWatchTransactionRequest: {},
|
|
17
|
+
cardanoSignTransactionRequest: {}
|
|
16
18
|
});
|
|
17
19
|
confirmationsPromiseMap = {};
|
|
18
20
|
constructor(requestService) {
|
|
@@ -114,9 +116,11 @@ export default class CardanoRequestHandler {
|
|
|
114
116
|
async decorateResult(t, request, result) {
|
|
115
117
|
if (result.payload === '') {
|
|
116
118
|
if (t === 'cardanoSignatureRequest') {
|
|
117
|
-
|
|
119
|
+
result.payload = this.signMessage(request);
|
|
118
120
|
} else if (t === 'cardanoSendTransactionRequest') {
|
|
119
121
|
result.payload = this.signTransactionCardano(request);
|
|
122
|
+
} else if (t === 'cardanoSignTransactionRequest') {
|
|
123
|
+
result.payload = this.signDappTransactionCardano(request);
|
|
120
124
|
}
|
|
121
125
|
if (t === 'cardanoSignatureRequest' || t === 'cardanoSendTransactionRequest') {
|
|
122
126
|
const isAlwaysRequired = await this.#requestService.settingService.isAlwaysRequired;
|
|
@@ -126,6 +130,17 @@ export default class CardanoRequestHandler {
|
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
}
|
|
133
|
+
signMessage(confirmation) {
|
|
134
|
+
const {
|
|
135
|
+
address,
|
|
136
|
+
payload
|
|
137
|
+
} = confirmation.payload;
|
|
138
|
+
const pair = keyring.getPair(address);
|
|
139
|
+
if (pair.isLocked) {
|
|
140
|
+
keyring.unlockPair(pair.address);
|
|
141
|
+
}
|
|
142
|
+
return pair.cardano.signMessage(payload, true);
|
|
143
|
+
}
|
|
129
144
|
signTransactionCardano(confirmation) {
|
|
130
145
|
// alibaba
|
|
131
146
|
const transaction = confirmation.payload;
|
|
@@ -137,7 +152,34 @@ export default class CardanoRequestHandler {
|
|
|
137
152
|
if (pair.isLocked) {
|
|
138
153
|
keyring.unlockPair(pair.address);
|
|
139
154
|
}
|
|
140
|
-
return pair.cardano.
|
|
155
|
+
return pair.cardano.signTransaction(cardanoPayload);
|
|
156
|
+
}
|
|
157
|
+
signDappTransactionCardano(confirmation) {
|
|
158
|
+
var _FixedTransaction$fro;
|
|
159
|
+
// alibaba
|
|
160
|
+
const transaction = confirmation.payload;
|
|
161
|
+
const {
|
|
162
|
+
addressRequireKeyTypes,
|
|
163
|
+
cardanoPayload,
|
|
164
|
+
from
|
|
165
|
+
} = transaction;
|
|
166
|
+
const vkeyWitnessesFinal = Vkeywitnesses.new();
|
|
167
|
+
const txWitnessSet = (_FixedTransaction$fro = FixedTransaction.from_hex(cardanoPayload).witness_set()) !== null && _FixedTransaction$fro !== void 0 ? _FixedTransaction$fro : TransactionWitnessSet.new();
|
|
168
|
+
const pair = keyring.getPair(from);
|
|
169
|
+
if (pair.isLocked) {
|
|
170
|
+
keyring.unlockPair(pair.address);
|
|
171
|
+
}
|
|
172
|
+
const keyTypes = [...new Set(addressRequireKeyTypes)];
|
|
173
|
+
const vKeyWitnessesHex = pair.cardano.signTransaction(cardanoPayload, {
|
|
174
|
+
needVkeywitness: true,
|
|
175
|
+
keyTypes
|
|
176
|
+
});
|
|
177
|
+
const vKeyWitnesses = Vkeywitnesses.from_hex(vKeyWitnessesHex);
|
|
178
|
+
for (let i = 0; i < vKeyWitnesses.len(); i++) {
|
|
179
|
+
vkeyWitnessesFinal.add(vKeyWitnesses.get(i));
|
|
180
|
+
}
|
|
181
|
+
txWitnessSet.set_vkeys(vkeyWitnessesFinal);
|
|
182
|
+
return txWitnessSet.to_hex();
|
|
141
183
|
}
|
|
142
184
|
resetWallet() {
|
|
143
185
|
const confirmations = this.confirmationsQueueSubjectCardano.getValue();
|
|
@@ -1,2 +1,56 @@
|
|
|
1
|
+
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
|
|
2
|
+
import { CardanoBalanceItem, CardanoUtxosItem } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/types';
|
|
1
3
|
import { MetadataStore } from '@subwallet/extension-base/stores';
|
|
2
4
|
export declare const extractMetadata: (store: MetadataStore) => void;
|
|
5
|
+
export declare const convertAssetToValue: (amount: CardanoBalanceItem[]) => CardanoWasm.Value;
|
|
6
|
+
export declare const convertValueToAsset: (value: CardanoWasm.Value) => CardanoBalanceItem[];
|
|
7
|
+
export declare const convertUtxoRawToUtxo: (utxos: CardanoUtxosItem[]) => CardanoWasm.TransactionUnspentOutput[];
|
|
8
|
+
export declare function getBalanceAddressMap(outputs: CardanoWasm.TransactionOutputs): Record<string, CardanoWasm.Value>;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts all required key hashes from a list of certificates.
|
|
11
|
+
* Handles different certificate kinds: stake deregistration, delegation,
|
|
12
|
+
* pool registration, pool retirement, and MIR (move instantaneous rewards).
|
|
13
|
+
*
|
|
14
|
+
* Only processes key hash credentials (ignores script credentials).
|
|
15
|
+
*
|
|
16
|
+
* @param {Certificates} certificates - List of certificate objects from a transaction body.
|
|
17
|
+
* @returns {string[]} - An array of required key hashes in hex format.
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractKeyHashFromCertificate(certificates?: CardanoWasm.Certificates): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Extracts required key hashes from withdrawal entries.
|
|
22
|
+
* It processes only credentials of kind 0 (key hash based).
|
|
23
|
+
*
|
|
24
|
+
* @param {Withdrawals} withdrawals - The withdrawal map from a transaction body.
|
|
25
|
+
* @returns {string[]} - An array of required key hashes in hex format.
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractKeyHashesFromWithdrawals(withdrawals?: CardanoWasm.Withdrawals): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Recursively extract all Ed25519 key hashes from a NativeScripts collection.
|
|
30
|
+
* Only processes `ScriptPubkey` entries (kind = 0), and traverses through nested scripts.
|
|
31
|
+
*
|
|
32
|
+
* @param {NativeScripts} scripts - A collection of native scripts.
|
|
33
|
+
* @returns {string[]} - An array of key hashes (hex-encoded) from all script_pubkey entries.
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractKeyHashesFromScripts(scripts?: CardanoWasm.NativeScripts): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Extract required key hashes from the RequiredSigners field in the transaction body.
|
|
38
|
+
* Each entry is an Ed25519 key hash that must sign the transaction.
|
|
39
|
+
*
|
|
40
|
+
* @param {Ed25519KeyHashes} requiredSigners - A list of required signer key hashes.
|
|
41
|
+
* @returns {string[]} - Array of hex-encoded Ed25519 key hashes.
|
|
42
|
+
*/
|
|
43
|
+
export declare function extractKeyHashesFromRequiredSigners(requiredSigners?: CardanoWasm.Ed25519KeyHashes): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Extract required key hashes from collateral inputs in a linear and readable flow.
|
|
46
|
+
*
|
|
47
|
+
* This function resolves UTXOs of each collateral input,
|
|
48
|
+
* attempts to extract the payment key hash from various supported address types,
|
|
49
|
+
* and returns an array of required signer key hashes in hex format.
|
|
50
|
+
*
|
|
51
|
+
* @param {TransactionInputs} collaterals - Collateral inputs used for script validation
|
|
52
|
+
* @param getSpecificUtxo
|
|
53
|
+
* @returns {Promise<string[]>} - Hex-encoded key hashes required to sign the transaction
|
|
54
|
+
*/
|
|
55
|
+
export declare function extractKeyHashesFromCollaterals(collaterals?: CardanoWasm.TransactionInputs, getSpecificUtxo?: (txHash: string, txId: number) => Promise<CardanoUtxosItem | undefined>): Promise<string[]>;
|
|
56
|
+
export declare function hasSufficientCardanoValue(valueA: CardanoWasm.Value, valueB: CardanoWasm.Value): boolean;
|