@meshsdk/core 1.5.11-beta.6 → 1.5.11-beta.7

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,8 +1,25 @@
1
1
  import { IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
2
2
  import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/common/types';
3
+ /**
4
+ * [Blockfrost](https://blockfrost.io/) provides restful APIs which allows your app to access information stored on the blockchain.
5
+ *
6
+ * Get started:
7
+ * ```ts
8
+ * const blockfrostProvider = new BlockfrostProvider('<BLOCKFROST_API_KEY>');
9
+ * ```
10
+ */
3
11
  export declare class BlockfrostProvider implements IFetcher, IListener, ISubmitter {
4
12
  private readonly _axiosInstance;
13
+ /**
14
+ * If you are using a privately hosted Blockfrost instance, you can set the URL in the parameter.
15
+ * @param baseUrl The base URL of the instance.
16
+ */
5
17
  constructor(baseUrl: string);
18
+ /**
19
+ * If you are using [Blockfrost](https://blockfrost.io/) hosted instance, you can set the project ID in the parameter.
20
+ * @param projectId The project ID of the instance.
21
+ * @param version The version of the API. Default is 0.
22
+ */
6
23
  constructor(projectId: string, version?: number);
7
24
  fetchAccountInfo(address: string): Promise<AccountInfo>;
8
25
  private resolveScriptRef;
@@ -1,6 +1,6 @@
1
- import { Action, Asset, Data, LanguageVersion, Protocol, UTxO } from '@mesh/common/types';
1
+ import { Action, Asset, Data, LanguageVersion, Protocol, UTxO, PoolParams } from '@mesh/common/types';
2
2
  import { csl } from '@mesh/core';
3
- import { MintItem, TxIn, PubKeyTxIn, MeshTxBuilderBody, RefTxIn, BuilderData } from './type';
3
+ import { MintItem, TxIn, PubKeyTxIn, MeshTxBuilderBody, RefTxIn, BuilderData, Certificate } from './type';
4
4
  export declare class MeshTxBuilderCore {
5
5
  txHex: string;
6
6
  txBuilder: csl.TransactionBuilder;
@@ -155,7 +155,7 @@ export declare class MeshTxBuilderCore {
155
155
  * @param name The hex of token name of the asset to be minted
156
156
  * @returns The MeshTxBuilder instance
157
157
  */
158
- mint: (quantity: number, policy: string, name: string) => this;
158
+ mint: (quantity: string, policy: string, name: string) => this;
159
159
  /**
160
160
  * Set the minting script of current mint
161
161
  * @param scriptCBOR The CBOR hex of the minting policy script
@@ -207,6 +207,39 @@ export declare class MeshTxBuilderCore {
207
207
  * @returns The MeshTxBuilder instance
208
208
  */
209
209
  txInCollateral: (txHash: string, txIndex: number, amount?: Asset[], address?: string) => this;
210
+ /**
211
+ * Creates a pool registration certificate, and adds it to the transaction
212
+ * @param poolParams Parameters for pool registration
213
+ * @returns The MeshTxBuilder instance
214
+ */
215
+ registerPoolCertificate: (poolParams: PoolParams) => this;
216
+ /**
217
+ * Creates a stake registration certificate, and adds it to the transaction
218
+ * @param stakeKeyHash The keyHash of the stake key
219
+ * @returns The MeshTxBuilder instance
220
+ */
221
+ registerStakeCertificate: (stakeKeyHash: string) => this;
222
+ /**
223
+ * Creates a stake delegation certificate, and adds it to the transaction
224
+ * This will delegate stake from the corresponding stake address to the pool
225
+ * @param stakeKeyHash The keyHash of the stake key
226
+ * @param poolId poolId can be in either bech32 or hex form
227
+ * @returns The MeshTxBuilder instance
228
+ */
229
+ delegateStakeCertificate: (stakeKeyHash: string, poolId: string) => this;
230
+ /**
231
+ * Creates a stake deregister certificate, and adds it to the transaction
232
+ * @param stakeKeyHash The keyHash of the stake key
233
+ * @returns The MeshTxBuilder instance
234
+ */
235
+ deregisterStakeCertificate: (stakeKeyHash: string) => this;
236
+ /**
237
+ * Creates a pool retire certificate, and adds it to the transaction
238
+ * @param poolId poolId can be in either bech32 or hex form
239
+ * @param epoch The intended epoch to retire the pool
240
+ * @returns The MeshTxBuilder instance
241
+ */
242
+ retirePoolCertificate: (poolId: string, epoch: number) => this;
210
243
  /**
211
244
  * Configure the address to accept change UTxO
212
245
  * @param addr The address to accept change UTxO
@@ -256,6 +289,7 @@ export declare class MeshTxBuilderCore {
256
289
  private queueInput;
257
290
  private queueMint;
258
291
  private makePlutusScriptSource;
292
+ protected removeDuplicateInputs: () => void;
259
293
  private addAllInputs;
260
294
  private addTxIn;
261
295
  private addScriptTxIn;
@@ -269,7 +303,11 @@ export declare class MeshTxBuilderCore {
269
303
  protected addAllMints: (mints: MintItem[]) => void;
270
304
  private addPlutusMint;
271
305
  private addNativeMint;
306
+ private decimalToFraction;
307
+ private toPoolParams;
308
+ private addCertificate;
272
309
  protected queueAllLastItem: () => void;
310
+ protected addAllCertificates: (allCertificates: Certificate[]) => void;
273
311
  protected addCostModels: () => void;
274
312
  private addChange;
275
313
  private addValidityRange;
@@ -1,4 +1,4 @@
1
- import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO } from '@mesh/common/types';
1
+ import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO, PoolParams } from '@mesh/common/types';
2
2
  export declare type MeshTxBuilderBody = {
3
3
  inputs: TxIn[];
4
4
  outputs: Output[];
@@ -11,6 +11,7 @@ export declare type MeshTxBuilderBody = {
11
11
  changeAddress: string;
12
12
  metadata: Metadata[];
13
13
  validityRange: ValidityRange;
14
+ certificates: Certificate[];
14
15
  signingKey: string[];
15
16
  };
16
17
  export declare type TxIn = PubKeyTxIn | ScriptTxIn;
@@ -70,7 +71,7 @@ export declare type MintItem = {
70
71
  type: 'Plutus' | 'Native';
71
72
  policyId: string;
72
73
  assetName: string;
73
- amount: number;
74
+ amount: string;
74
75
  redeemer?: Redeemer;
75
76
  scriptSource?: {
76
77
  type: 'Provided';
@@ -104,6 +105,24 @@ export declare type Metadata = {
104
105
  tag: string;
105
106
  metadata: object;
106
107
  };
108
+ export declare type Certificate = {
109
+ type: 'RegisterPool';
110
+ poolParams: PoolParams;
111
+ } | {
112
+ type: 'RegisterStake';
113
+ stakeKeyHash: string;
114
+ } | {
115
+ type: 'DelegateStake';
116
+ stakeKeyHash: string;
117
+ poolId: string;
118
+ } | {
119
+ type: 'DeregisterStake';
120
+ stakeKeyHash: string;
121
+ } | {
122
+ type: 'RetirePool';
123
+ poolId: string;
124
+ epoch: number;
125
+ };
107
126
  export declare type RequiredWith<T, K extends keyof T> = Required<T> & {
108
127
  [P in K]: Required<T[P]>;
109
128
  };
@@ -13,13 +13,13 @@ export declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
13
13
  getRewardAddresses(): Promise<string[]>;
14
14
  getUnusedAddresses(): Promise<string[]>;
15
15
  getUsedAddresses(): Promise<string[]>;
16
- getUtxos(): Promise<UTxO[]>;
16
+ getUtxos(amount?: Asset[] | undefined): Promise<UTxO[]>;
17
17
  signData(address: string, payload: string): Promise<DataSignature>;
18
18
  signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
19
19
  submitTx(tx: string): Promise<string>;
20
20
  getUsedAddress(): Promise<Address>;
21
21
  getUsedCollateral(limit?: number): Promise<TransactionUnspentOutput[]>;
22
- getUsedUTxOs(): Promise<TransactionUnspentOutput[]>;
22
+ getUsedUTxOs(amount?: Asset[] | undefined): Promise<TransactionUnspentOutput[]>;
23
23
  getAssets(): Promise<AssetExtended[]>;
24
24
  getLovelace(): Promise<string>;
25
25
  getPolicyIdAssets(policyId: string): Promise<AssetExtended[]>;
@@ -47,7 +47,7 @@ declare type WalletInstance = {
47
47
  getRewardAddresses(): Promise<string[]>;
48
48
  getUnusedAddresses(): Promise<string[]>;
49
49
  getUsedAddresses(): Promise<string[]>;
50
- getUtxos(): Promise<string[] | undefined>;
50
+ getUtxos(amount: string | undefined): Promise<string[] | undefined>;
51
51
  signData(address: string, payload: string): Promise<DataSignature>;
52
52
  signTx(tx: string, partialSign: boolean): Promise<string>;
53
53
  submitTx(tx: string): Promise<string>;
@@ -1,4 +1,3 @@
1
1
  export * from './app.service';
2
2
  export * from './browser.service';
3
3
  export * from './embedded.service';
4
- export * from './mina.service';
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.5.11-beta.6",
6
+ "version": "1.5.11-beta.7",
7
7
  "license": "Apache-2.0",
8
8
  "type": "module",
9
9
  "repository": {
@@ -32,9 +32,11 @@
32
32
  "test": "vitest --run",
33
33
  "test:watch": "vitest",
34
34
  "test:coverage": "vitest run --coverage",
35
- "build": "vite build",
35
+ "build": "vite build && yarn docs",
36
36
  "prepare": "yarn lint && yarn test && yarn build",
37
- "dev": "vite build --watch"
37
+ "dev": "vite build --watch",
38
+ "docs": "typedoc src/index.ts --json ../docs/src/data/api.json",
39
+ "docs2": "typedoc src/index.ts --out ../docs/tmp"
38
40
  },
39
41
  "husky": {
40
42
  "hooks": {
@@ -59,6 +61,7 @@
59
61
  "husky": "8.0.1",
60
62
  "rollup": "2.79.0",
61
63
  "tslib": "2.4.0",
64
+ "typedoc": "^0.25.8",
62
65
  "vite": "3.1.4",
63
66
  "vite-plugin-eslint": "1.8.1",
64
67
  "vite-plugin-wasm": "2.1.0",