@onekeyfe/cardano-coin-selection-asmjs 1.1.10-alpha.5 → 1.1.10-alpha.6
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-asmjs';
|
|
2
|
-
import { IAdaAmount, IAdaUTXO,
|
|
2
|
+
import { IAdaAmount, IAdaUTXO, IEncodedTxADA, IConvertCborTxParams } from './types';
|
|
3
3
|
export declare const assetsToValue: (assets: IAdaAmount[]) => Promise<CardanoWasm.Value>;
|
|
4
4
|
export declare const extractKeyHash: (address: string) => Promise<string>;
|
|
5
5
|
export declare const dAppUtils: {
|
|
6
6
|
getBalance: (balances: IAdaAmount[]) => Promise<string>;
|
|
7
7
|
getAddresses: (addresses: string[]) => Promise<string[]>;
|
|
8
8
|
getUtxos: (address: string, utxos: IAdaUTXO[], amount?: string) => Promise<string[] | null | undefined>;
|
|
9
|
-
convertCborTxToEncodeTx: (txHex
|
|
9
|
+
convertCborTxToEncodeTx: ({ txHex, utxos, addresses, changeAddress, isSignOnly, }: IConvertCborTxParams) => Promise<IEncodedTxADA>;
|
|
10
10
|
signData: (address: string, payload: string, xprv: string, accountIndex: number) => Promise<{
|
|
11
11
|
signature: string;
|
|
12
12
|
key: string;
|
|
@@ -87,7 +87,7 @@ const getUtxos = async (address, utxos, amount) => {
|
|
|
87
87
|
}
|
|
88
88
|
return converted === null || converted === void 0 ? void 0 : converted.map(utxo => Buffer.from(utxo.to_bytes(), 'hex').toString('hex'));
|
|
89
89
|
};
|
|
90
|
-
const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) => {
|
|
90
|
+
const convertCborTxToEncodeTx = async ({ txHex, utxos, addresses, changeAddress, isSignOnly, }) => {
|
|
91
91
|
var _a, _b, _c, _d;
|
|
92
92
|
let body;
|
|
93
93
|
let rawTxHex;
|
|
@@ -260,7 +260,7 @@ const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) =
|
|
|
260
260
|
size: 0,
|
|
261
261
|
rawTxHex,
|
|
262
262
|
},
|
|
263
|
-
signOnly:
|
|
263
|
+
signOnly: isSignOnly,
|
|
264
264
|
staking: stakingInfo,
|
|
265
265
|
};
|
|
266
266
|
console.log('Cardano DApp EncodedTx: ', encodedTx);
|
|
@@ -94,4 +94,11 @@ export type ICardanoCertificate = {
|
|
|
94
94
|
stakeCredential?: string;
|
|
95
95
|
poolKeyHash?: string;
|
|
96
96
|
};
|
|
97
|
+
export type IConvertCborTxParams = {
|
|
98
|
+
txHex: string;
|
|
99
|
+
utxos: IAdaUTXO[];
|
|
100
|
+
addresses: string[];
|
|
101
|
+
changeAddress: IChangeAddress;
|
|
102
|
+
isSignOnly: boolean;
|
|
103
|
+
};
|
|
97
104
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-asmjs';
|
|
2
|
-
import { IAdaAmount, IAdaUTXO,
|
|
2
|
+
import { IAdaAmount, IAdaUTXO, IEncodedTxADA, IConvertCborTxParams } from './types';
|
|
3
3
|
export declare const assetsToValue: (assets: IAdaAmount[]) => Promise<CardanoWasm.Value>;
|
|
4
4
|
export declare const extractKeyHash: (address: string) => Promise<string>;
|
|
5
5
|
export declare const dAppUtils: {
|
|
6
6
|
getBalance: (balances: IAdaAmount[]) => Promise<string>;
|
|
7
7
|
getAddresses: (addresses: string[]) => Promise<string[]>;
|
|
8
8
|
getUtxos: (address: string, utxos: IAdaUTXO[], amount?: string) => Promise<string[] | null | undefined>;
|
|
9
|
-
convertCborTxToEncodeTx: (txHex
|
|
9
|
+
convertCborTxToEncodeTx: ({ txHex, utxos, addresses, changeAddress, isSignOnly, }: IConvertCborTxParams) => Promise<IEncodedTxADA>;
|
|
10
10
|
signData: (address: string, payload: string, xprv: string, accountIndex: number) => Promise<{
|
|
11
11
|
signature: string;
|
|
12
12
|
key: string;
|
|
@@ -57,7 +57,7 @@ const getUtxos = async (address, utxos, amount) => {
|
|
|
57
57
|
}
|
|
58
58
|
return converted === null || converted === void 0 ? void 0 : converted.map(utxo => Buffer.from(utxo.to_bytes(), 'hex').toString('hex'));
|
|
59
59
|
};
|
|
60
|
-
const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) => {
|
|
60
|
+
const convertCborTxToEncodeTx = async ({ txHex, utxos, addresses, changeAddress, isSignOnly, }) => {
|
|
61
61
|
var _a, _b, _c, _d;
|
|
62
62
|
let body;
|
|
63
63
|
let rawTxHex;
|
|
@@ -230,7 +230,7 @@ const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) =
|
|
|
230
230
|
size: 0,
|
|
231
231
|
rawTxHex,
|
|
232
232
|
},
|
|
233
|
-
signOnly:
|
|
233
|
+
signOnly: isSignOnly,
|
|
234
234
|
staking: stakingInfo,
|
|
235
235
|
};
|
|
236
236
|
console.log('Cardano DApp EncodedTx: ', encodedTx);
|
|
@@ -94,4 +94,11 @@ export type ICardanoCertificate = {
|
|
|
94
94
|
stakeCredential?: string;
|
|
95
95
|
poolKeyHash?: string;
|
|
96
96
|
};
|
|
97
|
+
export type IConvertCborTxParams = {
|
|
98
|
+
txHex: string;
|
|
99
|
+
utxos: IAdaUTXO[];
|
|
100
|
+
addresses: string[];
|
|
101
|
+
changeAddress: IChangeAddress;
|
|
102
|
+
isSignOnly: boolean;
|
|
103
|
+
};
|
|
97
104
|
export {};
|