@meshsdk/core 1.2.1 → 1.4.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/dist/common/constants.d.ts +1 -0
- package/dist/common/contracts/evaluator.d.ts +4 -0
- package/dist/common/contracts/fetcher.d.ts +3 -1
- package/dist/common/contracts/index.d.ts +2 -0
- package/dist/common/contracts/listener.d.ts +3 -0
- package/dist/common/helpers/generateNonce.d.ts +1 -0
- package/dist/common/helpers/index.d.ts +3 -0
- package/dist/common/helpers/readPlutusData.d.ts +2 -0
- package/dist/common/helpers/readTransaction.d.ts +2 -0
- package/dist/common/types/BlockInfo.d.ts +17 -0
- package/dist/common/types/Network.d.ts +4 -1
- package/dist/common/types/PoolParams.d.ts +2 -2
- package/dist/common/types/TransactionInfo.d.ts +11 -0
- package/dist/common/types/index.d.ts +2 -0
- package/dist/common/utils/builder.d.ts +3 -2
- package/dist/common/utils/converter.d.ts +2 -1
- package/dist/common/utils/deserializer.d.ts +2 -0
- package/dist/common/utils/parser.d.ts +4 -0
- package/dist/core/CIP8.d.ts +3 -1
- package/dist/core/CSL.d.ts +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1423 -1080
- package/dist/index.d.ts +2 -0
- package/dist/providers/blockfrost.provider.d.ts +7 -3
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/koios.provider.d.ts +7 -3
- package/dist/providers/ogmios.provider.d.ts +12 -0
- package/dist/providers/tango.provider.d.ts +7 -3
- package/dist/transaction/transaction.service.d.ts +75 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './common/contracts';
|
|
2
2
|
export * from './common/types';
|
|
3
|
+
export { generateNonce } from './common/helpers';
|
|
3
4
|
export * from './common/utils/resolver';
|
|
4
5
|
export * from './core/CIP2';
|
|
6
|
+
export { checkSignature } from './core/CIP8';
|
|
5
7
|
export * from './providers';
|
|
6
8
|
export * from './scripts';
|
|
7
9
|
export * from './transaction';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IFetcher, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
-
import type { AccountInfo, AssetMetadata, Protocol, UTxO } from '@mesh/common/types';
|
|
3
|
-
export declare class BlockfrostProvider implements IFetcher, ISubmitter {
|
|
1
|
+
import { IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/common/types';
|
|
3
|
+
export declare class BlockfrostProvider implements IFetcher, IListener, ISubmitter {
|
|
4
4
|
private readonly _axiosInstance;
|
|
5
|
+
constructor(baseUrl: string);
|
|
5
6
|
constructor(projectId: string, version?: number);
|
|
6
7
|
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
7
8
|
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
@@ -10,8 +11,11 @@ export declare class BlockfrostProvider implements IFetcher, ISubmitter {
|
|
|
10
11
|
quantity: string;
|
|
11
12
|
}[]>;
|
|
12
13
|
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
14
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
13
15
|
fetchHandleAddress(handle: string): Promise<string>;
|
|
14
16
|
fetchProtocolParameters(epoch?: number): Promise<Protocol>;
|
|
17
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
18
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
15
19
|
submitTx(tx: string): Promise<string>;
|
|
16
20
|
private fetchPlutusScriptCBOR;
|
|
17
21
|
private fetchNativeScriptJSON;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IFetcher, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
-
import type { AccountInfo, AssetMetadata, Protocol, UTxO } from '@mesh/common/types';
|
|
3
|
-
export declare class KoiosProvider implements IFetcher, ISubmitter {
|
|
1
|
+
import { IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/common/types';
|
|
3
|
+
export declare class KoiosProvider implements IFetcher, IListener, ISubmitter {
|
|
4
4
|
private readonly _axiosInstance;
|
|
5
|
+
constructor(baseUrl: string);
|
|
5
6
|
constructor(network: 'api' | 'preview' | 'preprod' | 'guild', version?: number);
|
|
6
7
|
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
7
8
|
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
@@ -10,7 +11,10 @@ export declare class KoiosProvider implements IFetcher, ISubmitter {
|
|
|
10
11
|
quantity: string;
|
|
11
12
|
}[]>;
|
|
12
13
|
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
14
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
13
15
|
fetchHandleAddress(handle: string): Promise<string>;
|
|
14
16
|
fetchProtocolParameters(epoch: number): Promise<Protocol>;
|
|
17
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
18
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
15
19
|
submitTx(tx: string): Promise<string>;
|
|
16
20
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IEvaluator, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import { Action, Network } from '@mesh/common/types';
|
|
3
|
+
export declare class OgmiosProvider implements IEvaluator, ISubmitter {
|
|
4
|
+
private readonly _baseUrl;
|
|
5
|
+
constructor(baseUrl: string);
|
|
6
|
+
constructor(network: Network);
|
|
7
|
+
evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
|
|
8
|
+
onNextTx(callback: (tx: unknown) => void): Promise<() => void>;
|
|
9
|
+
submitTx(tx: string): Promise<string>;
|
|
10
|
+
private open;
|
|
11
|
+
private send;
|
|
12
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IFetcher, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
-
import type { AccountInfo, AssetMetadata, Protocol, UTxO } from '@mesh/common/types';
|
|
3
|
-
export declare class TangoProvider implements IFetcher, ISubmitter {
|
|
1
|
+
import { IEvaluator, IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, Action, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/common/types';
|
|
3
|
+
export declare class TangoProvider implements IEvaluator, IFetcher, IListener, ISubmitter {
|
|
4
4
|
private readonly _axiosInstance;
|
|
5
5
|
constructor(network: 'mainnet' | 'testnet', appId: string, appKey: string, version?: number);
|
|
6
|
+
evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
|
|
6
7
|
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
7
8
|
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
8
9
|
fetchAssetAddresses(asset: string): Promise<{
|
|
@@ -10,7 +11,10 @@ export declare class TangoProvider implements IFetcher, ISubmitter {
|
|
|
10
11
|
quantity: string;
|
|
11
12
|
}[]>;
|
|
12
13
|
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
14
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
13
15
|
fetchHandleAddress(handle: string): Promise<string>;
|
|
14
16
|
fetchProtocolParameters(epoch: number): Promise<Protocol>;
|
|
17
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
18
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
15
19
|
submitTx(tx: string): Promise<string>;
|
|
16
20
|
}
|
|
@@ -7,23 +7,24 @@ export declare class Transaction {
|
|
|
7
7
|
private _totalMints;
|
|
8
8
|
private readonly _era?;
|
|
9
9
|
private readonly _initiator?;
|
|
10
|
+
private readonly _mintBuilder;
|
|
10
11
|
private readonly _protocolParameters;
|
|
11
12
|
private readonly _txBuilder;
|
|
12
13
|
private readonly _txCertificates;
|
|
13
14
|
private readonly _txInputsBuilder;
|
|
14
15
|
private readonly _txWithdrawals;
|
|
15
16
|
constructor(options?: Partial<CreateTxOptions>);
|
|
16
|
-
static maskMetadata(cborTx: string): string;
|
|
17
|
+
static maskMetadata(cborTx: string, era?: Era): string;
|
|
17
18
|
static readMetadata(cborTx: string): string;
|
|
18
|
-
static writeMetadata(cborTx: string, cborTxMetadata: string): string;
|
|
19
|
+
static writeMetadata(cborTx: string, cborTxMetadata: string, era?: Era): string;
|
|
19
20
|
get size(): number;
|
|
20
21
|
build(): Promise<string>;
|
|
21
|
-
burnAsset(forgeScript: string, asset: Asset): Transaction;
|
|
22
|
+
burnAsset(forgeScript: string | PlutusScript | UTxO, asset: Asset, redeemer?: Partial<Action>): Transaction;
|
|
22
23
|
delegateStake(rewardAddress: string, poolId: string): Transaction;
|
|
23
24
|
deregisterStake(rewardAddress: string): Transaction;
|
|
24
|
-
mintAsset(forgeScript: string, mint: Mint): Transaction;
|
|
25
|
+
mintAsset(forgeScript: string | PlutusScript | UTxO, mint: Mint, redeemer?: Partial<Action>): Transaction;
|
|
25
26
|
redeemValue(options: {
|
|
26
|
-
value: UTxO
|
|
27
|
+
value: UTxO;
|
|
27
28
|
script: PlutusScript | UTxO;
|
|
28
29
|
datum: Data | UTxO;
|
|
29
30
|
redeemer?: Action;
|
|
@@ -31,15 +32,84 @@ export declare class Transaction {
|
|
|
31
32
|
registerStake(rewardAddress: string): Transaction;
|
|
32
33
|
registerPool(params: PoolParams): Transaction;
|
|
33
34
|
retirePool(poolId: string, epochNo: number): Transaction;
|
|
35
|
+
/**
|
|
36
|
+
* Adds an output to the transaction.
|
|
37
|
+
*
|
|
38
|
+
* @param recipient The recipient of the output.
|
|
39
|
+
* @param assets The assets to send.
|
|
40
|
+
* @returns The transaction builder.
|
|
41
|
+
* @see {@link https://meshjs.dev/apis/transaction#sendAssets}
|
|
42
|
+
*/
|
|
34
43
|
sendAssets(recipient: Recipient, assets: Asset[]): Transaction;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a transaction output to the transaction.
|
|
46
|
+
*
|
|
47
|
+
* @param {Recipient} recipient The recipient of the transaction.
|
|
48
|
+
* @param {string} lovelace The amount of lovelace to send.
|
|
49
|
+
* @returns {Transaction} The Transaction object.
|
|
50
|
+
* @see {@link https://meshjs.dev/apis/transaction#sendAda}
|
|
51
|
+
*/
|
|
35
52
|
sendLovelace(recipient: Recipient, lovelace: string): Transaction;
|
|
53
|
+
/**
|
|
54
|
+
* Adds an output to the transaction.
|
|
55
|
+
*
|
|
56
|
+
* @param {Recipient} recipient The recipient of the output.
|
|
57
|
+
* @param {UTxO} value The UTxO value of the output.
|
|
58
|
+
* @returns {Transaction} The Transaction object.
|
|
59
|
+
*/
|
|
36
60
|
sendValue(recipient: Recipient, value: UTxO): Transaction;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the change address for the transaction.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} changeAddress The change address.
|
|
65
|
+
* @returns {Transaction} The Transaction object.
|
|
66
|
+
*/
|
|
37
67
|
setChangeAddress(changeAddress: string): Transaction;
|
|
68
|
+
/**
|
|
69
|
+
* Sets the collateral for the transaction.
|
|
70
|
+
*
|
|
71
|
+
* @param {UTxO[]} collateral - Set the UTxO for collateral.
|
|
72
|
+
* @returns {Transaction} The Transaction object.
|
|
73
|
+
*/
|
|
38
74
|
setCollateral(collateral: UTxO[]): Transaction;
|
|
75
|
+
/**
|
|
76
|
+
* Add a JSON metadata entry to the transaction.
|
|
77
|
+
*
|
|
78
|
+
* @param {number} key The key to use for the metadata entry.
|
|
79
|
+
* @param {unknown} value The value to use for the metadata entry.
|
|
80
|
+
* @returns {Transaction} The Transaction object.
|
|
81
|
+
* @see {@link https://meshjs.dev/apis/transaction#setMetadata}
|
|
82
|
+
*/
|
|
39
83
|
setMetadata(key: number, value: unknown): Transaction;
|
|
84
|
+
/**
|
|
85
|
+
* Sets the required signers for the transaction.
|
|
86
|
+
*
|
|
87
|
+
* @param {string[]} addresses The addresses of the required signers.
|
|
88
|
+
* @returns {Transaction} The Transaction object.
|
|
89
|
+
*/
|
|
40
90
|
setRequiredSigners(addresses: string[]): Transaction;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the start slot for the transaction.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} slot The start slot for the transaction.
|
|
95
|
+
* @returns {Transaction} The Transaction object.
|
|
96
|
+
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
97
|
+
*/
|
|
41
98
|
setTimeToStart(slot: string): Transaction;
|
|
99
|
+
/**
|
|
100
|
+
* Set the time to live for the transaction.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} slot The slot number to expire the transaction at.
|
|
103
|
+
* @returns {Transaction} The Transaction object.
|
|
104
|
+
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
105
|
+
*/
|
|
42
106
|
setTimeToExpire(slot: string): Transaction;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the inputs for the transaction.
|
|
109
|
+
*
|
|
110
|
+
* @param {UTxO[]} inputs The inputs to set.
|
|
111
|
+
* @returns {Transaction} The transaction.
|
|
112
|
+
*/
|
|
43
113
|
setTxInputs(inputs: UTxO[]): Transaction;
|
|
44
114
|
withdrawRewards(rewardAddress: string, lovelace: string): Transaction;
|
|
45
115
|
private addBurnInputsIfNeeded;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Rapidly build Web3 apps on the Cardano Blockchain.",
|
|
4
4
|
"homepage": "https://meshjs.dev",
|
|
5
5
|
"author": "MeshJS",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.4.0",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"repository": {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@emurgo/cardano-message-signing-browser": "1.0.1",
|
|
68
68
|
"@emurgo/cardano-message-signing-nodejs": "1.0.1",
|
|
69
|
-
"@emurgo/cardano-serialization-lib-browser": "11.
|
|
70
|
-
"@emurgo/cardano-serialization-lib-nodejs": "11.
|
|
69
|
+
"@emurgo/cardano-serialization-lib-browser": "11.2.1",
|
|
70
|
+
"@emurgo/cardano-serialization-lib-nodejs": "11.2.1",
|
|
71
71
|
"@emurgo/cip14-js": "3.0.1",
|
|
72
72
|
"axios": "0.27.2",
|
|
73
73
|
"bip39": "3.0.4",
|