@meshsdk/core 1.6.0-alpha.3 → 1.6.0-alpha.5

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 (69) hide show
  1. package/dist/common/constants.d.ts +58 -0
  2. package/dist/common/contracts/evaluator.d.ts +4 -0
  3. package/dist/common/contracts/fetcher.d.ts +22 -0
  4. package/dist/common/contracts/index.d.ts +7 -0
  5. package/dist/common/contracts/initiator.d.ts +8 -0
  6. package/dist/common/contracts/listener.d.ts +3 -0
  7. package/dist/common/contracts/signer.d.ts +8 -0
  8. package/dist/common/contracts/submitter.d.ts +3 -0
  9. package/dist/common/contracts/uploader.d.ts +3 -0
  10. package/dist/common/data/index.d.ts +2 -0
  11. package/dist/common/data/mesh.d.ts +8 -0
  12. package/dist/common/data/plutus.d.ts +72 -0
  13. package/dist/common/data/plutus.spec.d.ts +1 -0
  14. package/dist/common/helpers/generateNonce.d.ts +1 -0
  15. package/dist/common/helpers/index.d.ts +2 -0
  16. package/dist/common/helpers/readPlutusData.d.ts +2 -0
  17. package/dist/common/utils/parser.d.ts +5 -0
  18. package/dist/common/utils/resolver.d.ts +17 -0
  19. package/dist/core/CIP2.d.ts +4 -0
  20. package/dist/core/CIP8.d.ts +15 -0
  21. package/dist/core.cjs +13 -13
  22. package/dist/core.js +4697 -4510
  23. package/dist/index.d.ts +13 -0
  24. package/dist/providers/blockfrost.provider.d.ts +46 -0
  25. package/dist/providers/index.d.ts +6 -0
  26. package/dist/providers/infura.provider.d.ts +12 -0
  27. package/dist/providers/koios.provider.d.ts +27 -0
  28. package/dist/providers/maestro.provider.d.ts +35 -0
  29. package/dist/providers/ogmios.provider.d.ts +12 -0
  30. package/dist/providers/tango.provider.d.ts +25 -0
  31. package/dist/providers/yaci.provider.d.ts +32 -0
  32. package/dist/scripts/forge.script.d.ts +8 -0
  33. package/dist/scripts/index.d.ts +1 -0
  34. package/dist/serializer/serializer.d.ts +42 -0
  35. package/dist/transaction/index.d.ts +2 -0
  36. package/dist/transaction/meshTxBuilder/index.d.ts +2 -0
  37. package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +47 -0
  38. package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +292 -0
  39. package/dist/transaction/meshTxBuilder/type.d.ts +128 -0
  40. package/dist/transaction/transaction.service.d.ts +150 -0
  41. package/dist/types/Account.d.ts +5 -0
  42. package/dist/types/AccountInfo.d.ts +7 -0
  43. package/dist/types/Action.d.ts +12 -0
  44. package/dist/types/Asset.d.ts +7 -0
  45. package/dist/types/AssetExtended.d.ts +8 -0
  46. package/dist/types/AssetMetadata.d.ts +24 -0
  47. package/dist/types/BlockInfo.d.ts +17 -0
  48. package/dist/types/Data.d.ts +4 -0
  49. package/dist/types/DataSignature.d.ts +4 -0
  50. package/dist/types/Era.d.ts +1 -0
  51. package/dist/types/Mint.d.ts +10 -0
  52. package/dist/types/NativeScript.d.ts +14 -0
  53. package/dist/types/Network.d.ts +4 -0
  54. package/dist/types/PlutusScript.d.ts +6 -0
  55. package/dist/types/PoolParams.d.ts +16 -0
  56. package/dist/types/Protocol.d.ts +22 -0
  57. package/dist/types/Recipient.d.ts +11 -0
  58. package/dist/types/Relay.d.ts +13 -0
  59. package/dist/types/Token.d.ts +2 -0
  60. package/dist/types/TransactionInfo.d.ts +11 -0
  61. package/dist/types/UTxO.d.ts +15 -0
  62. package/dist/types/Wallet.d.ts +5 -0
  63. package/dist/types/index.d.ts +22 -0
  64. package/dist/wallet/app.service.d.ts +43 -0
  65. package/dist/wallet/browser.service.d.ts +205 -0
  66. package/dist/wallet/embedded.service.d.ts +20 -0
  67. package/dist/wallet/index.d.ts +4 -0
  68. package/dist/wallet/mesh.service.d.ts +188 -0
  69. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import { csl } from '@mesh/core';
2
+ import type { Costmdls } from '@mesh/core';
3
+ import type { Budget, Era, Network, Protocol } from '../types';
4
+ export declare const DEFAULT_REDEEMER_BUDGET: Budget;
5
+ export declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
6
+ export declare const HARDENED_KEY_START = 2147483648;
7
+ export declare const LANGUAGE_VERSIONS: {
8
+ V1: csl.Language;
9
+ V2: csl.Language;
10
+ };
11
+ export declare const POLICY_ID_LENGTH = 56;
12
+ export declare const REDEEMER_TAGS: {
13
+ CERT: csl.RedeemerTag;
14
+ MINT: csl.RedeemerTag;
15
+ REWARD: csl.RedeemerTag;
16
+ SPEND: csl.RedeemerTag;
17
+ };
18
+ export declare const SUPPORTED_CLOCKS: Record<Network, [
19
+ epoch: string,
20
+ slot: string,
21
+ systemStart: string,
22
+ epochLength: string
23
+ ]>;
24
+ export declare const SUPPORTED_COST_MODELS: Record<Era, Costmdls>;
25
+ export declare const SUPPORTED_LANGUAGE_VIEWS: Record<Era, Partial<Record<keyof typeof LANGUAGE_VERSIONS, string>>>;
26
+ export declare const SUPPORTED_HANDLES: Record<number, string>;
27
+ export declare const SUPPORTED_OGMIOS_LINKS: Record<Network, string>;
28
+ export declare const SUPPORTED_TOKENS: {
29
+ LQ: string;
30
+ MIN: string;
31
+ NTX: string;
32
+ iBTC: string;
33
+ iETH: string;
34
+ iUSD: string;
35
+ MILK: string;
36
+ AGIX: string;
37
+ MELD: string;
38
+ INDY: string;
39
+ CLAY: string;
40
+ MCOS: string;
41
+ DING: string;
42
+ GERO: string;
43
+ NMKR: string;
44
+ PAVIA: string;
45
+ HOSKY: string;
46
+ YUMMI: string;
47
+ C3: string;
48
+ GIMBAL: string;
49
+ SUNDAE: string;
50
+ GREENS: string;
51
+ GENS: string;
52
+ SOCIETY: string;
53
+ DJED: string;
54
+ SHEN: string;
55
+ WMT: string;
56
+ COPI: string;
57
+ };
58
+ export declare const SUPPORTED_WALLETS: string[];
@@ -0,0 +1,4 @@
1
+ import { Action } from '@mesh/types';
2
+ export interface IEvaluator {
3
+ evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
4
+ }
@@ -0,0 +1,22 @@
1
+ import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
2
+ /**
3
+ * Fetcher interface defines end points to query blockchain data.
4
+ */
5
+ export interface IFetcher {
6
+ fetchAccountInfo(address: string): Promise<AccountInfo>;
7
+ fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
8
+ fetchAssetAddresses(asset: string): Promise<{
9
+ address: string;
10
+ quantity: string;
11
+ }[]>;
12
+ fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
13
+ fetchBlockInfo(hash: string): Promise<BlockInfo>;
14
+ fetchCollectionAssets(policyId: string, cursor?: number | string): Promise<{
15
+ assets: Asset[];
16
+ next: string | number | null;
17
+ }>;
18
+ fetchHandleAddress(handle: string): Promise<string>;
19
+ fetchProtocolParameters(epoch: number): Promise<Protocol>;
20
+ fetchTxInfo(hash: string): Promise<TransactionInfo>;
21
+ fetchUTxOs(hash: string): Promise<UTxO[]>;
22
+ }
@@ -0,0 +1,7 @@
1
+ export * from './evaluator';
2
+ export * from './fetcher';
3
+ export * from './initiator';
4
+ export * from './listener';
5
+ export * from './signer';
6
+ export * from './submitter';
7
+ export * from './uploader';
@@ -0,0 +1,8 @@
1
+ import type { Address, TransactionUnspentOutput } from '@mesh/core';
2
+ export interface IInitiator {
3
+ getUsedAddress(): SometimesPromise<Address>;
4
+ getUsedCollateral(limit?: number): SometimesPromise<TransactionUnspentOutput[]>;
5
+ getUsedUTxOs(): SometimesPromise<TransactionUnspentOutput[]>;
6
+ }
7
+ declare type SometimesPromise<T> = Promise<T> | T;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface IListener {
2
+ onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
3
+ }
@@ -0,0 +1,8 @@
1
+ import { DataSignature } from '@mesh/types';
2
+ export interface ISigner {
3
+ signData(address: string, payload: string): SometimesPromise<DataSignature>;
4
+ signTx(unsignedTx: string, partialSign: boolean): SometimesPromise<string>;
5
+ signTxs(unsignedTxs: string[], partialSign: boolean): SometimesPromise<string[]>;
6
+ }
7
+ declare type SometimesPromise<T> = Promise<T> | T;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface ISubmitter {
2
+ submitTx(tx: string): Promise<string>;
3
+ }
@@ -0,0 +1,3 @@
1
+ export interface IUploader {
2
+ uploadContent(content: FormData, recursive: boolean): Promise<string>;
3
+ }
@@ -0,0 +1,2 @@
1
+ export * from './mesh';
2
+ export * from './plutus';
@@ -0,0 +1,8 @@
1
+ import { Data } from '@mesh/types';
2
+ export declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => Data;
3
+ export declare const mConStr0: <T extends Data[]>(fields: T) => Data;
4
+ export declare const mConStr1: <T extends Data[]>(fields: T) => Data;
5
+ export declare const mConStr2: <T extends Data[]>(fields: T) => Data;
6
+ export declare const mMaybeStakingHash: (stakeCredential: string) => Data;
7
+ export declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
8
+ export declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;
@@ -0,0 +1,72 @@
1
+ import { Asset } from '@mesh/types';
2
+ export declare type ConStr<N = any, T = any> = {
3
+ constructor: N;
4
+ fields: T;
5
+ };
6
+ export declare type ConStr0<T = any> = ConStr<0, T>;
7
+ export declare type ConStr1<T = any> = ConStr<1, T>;
8
+ export declare type ConStr2<T = any> = ConStr<2, T>;
9
+ export declare type Bool = ConStr0<[]> | ConStr1<[]>;
10
+ export declare type BuiltinByteString = {
11
+ bytes: string;
12
+ };
13
+ export declare type Integer = {
14
+ int: number;
15
+ };
16
+ export declare type List = {
17
+ list: PlutusData[];
18
+ };
19
+ export declare type ValidatorHash = BuiltinByteString;
20
+ export declare type PaymentPubKeyHash = BuiltinByteString;
21
+ export declare type PubKeyHash = PaymentPubKeyHash;
22
+ export declare type POSIXTime = Integer;
23
+ export declare type CurrencySymbol = BuiltinByteString;
24
+ export declare type TokenName = BuiltinByteString;
25
+ export declare type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[BuiltinByteString]>]>]>;
26
+ export declare type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
27
+ export declare type ScriptAddress = ConStr0<[
28
+ ConStr1<[ValidatorHash]>,
29
+ MaybeStakingHash
30
+ ]>;
31
+ export declare type AssetClass = ConStr0<[CurrencySymbol, TokenName]>;
32
+ export declare type TxOutRef = ConStr0<[ConStr0<[BuiltinByteString]>, Integer]>;
33
+ export declare type AssocMapItem<K, V> = {
34
+ k: K;
35
+ v: V;
36
+ };
37
+ export declare type DictItem<K, V> = {
38
+ k: K;
39
+ v: V;
40
+ };
41
+ export declare type AssocMap<K, V> = {
42
+ map: AssocMapItem<K, V>[];
43
+ };
44
+ export declare type Dict<K, V> = {
45
+ map: DictItem<K, V>[];
46
+ };
47
+ export declare type Tuple<K, V> = ConStr0<[K, V]>;
48
+ export declare type Value = AssocMap<CurrencySymbol, AssocMap<TokenName, Integer>>;
49
+ export declare type PlutusData = BuiltinByteString | Integer | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | PaymentPubKeyHash | PubKeyHash | POSIXTime | TxOutRef;
50
+ export declare const conStr: <N, T>(constructor: N, fields: T) => ConStr<N, T>;
51
+ export declare const conStr0: <T>(fields: T) => ConStr0<T>;
52
+ export declare const conStr1: <T>(fields: T) => ConStr1<T>;
53
+ export declare const conStr2: <T>(fields: T) => ConStr2<T>;
54
+ export declare const bool: (b: boolean) => Bool;
55
+ export declare const builtinByteString: (bytes: string) => BuiltinByteString;
56
+ export declare const integer: (int: number) => Integer;
57
+ export declare const list: (pList: PlutusData[]) => List;
58
+ export declare const currencySymbol: (bytes: string) => CurrencySymbol;
59
+ export declare const tokenName: (bytes: string) => TokenName;
60
+ export declare const maybeStakingHash: (stakeCredential: string) => MaybeStakingHash;
61
+ export declare const pubKeyAddress: (bytes: string, stakeCredential?: string) => PubKeyAddress;
62
+ export declare const scriptAddress: (bytes: string, stakeCredential?: string) => ScriptAddress;
63
+ export declare const assetClass: (policyId: string, assetName: string) => AssetClass;
64
+ export declare const txOutRef: (txHash: string, index: number) => TxOutRef;
65
+ export declare const paymentPubKeyHash: (bytes: string) => PaymentPubKeyHash;
66
+ export declare const pubKeyHash: (bytes: string) => PubKeyHash;
67
+ export declare const posixTime: (int: number) => POSIXTime;
68
+ export declare const assocMap: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
69
+ export declare const dict: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
70
+ export declare const tuple: <K, V>(key: K, value: V) => Tuple<K, V>;
71
+ export declare const value: (assets: Asset[]) => Value;
72
+ export declare const parsePlutusValueToAssets: (plutusValue: Value) => Asset[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const generateNonce: (label?: string, length?: number) => string;
@@ -0,0 +1,2 @@
1
+ export * from './generateNonce';
2
+ export * from './readPlutusData';
@@ -0,0 +1,2 @@
1
+ import type { Data } from '@mesh/types';
2
+ export declare const readPlutusData: (plutusData: string) => Data;
@@ -0,0 +1,5 @@
1
+ export declare const parseAssetUnit: (unit: string) => {
2
+ policyId: string;
3
+ assetName: string;
4
+ };
5
+ export declare const parseHttpError: (error: unknown) => string;
@@ -0,0 +1,17 @@
1
+ import type { Data, Era, LanguageVersion, NativeScript, Network, PlutusScript } from '@mesh/types';
2
+ export declare const resolveDataHash: (data: Data) => string;
3
+ export declare const resolveEpochNo: (network: Network, milliseconds?: number) => number;
4
+ export declare const resolveFingerprint: (policyId: string, assetName: string) => string;
5
+ export declare const resolveLanguageView: (era: Era, version: LanguageVersion) => string | undefined;
6
+ export declare const resolveNativeScriptHash: (script: NativeScript) => string;
7
+ export declare const resolvePaymentKeyHash: (bech32: string) => string;
8
+ export declare const resolvePlutusScriptAddress: (script: PlutusScript, networkId?: number) => string;
9
+ export declare const resolvePlutusScriptHash: (bech32: string) => string;
10
+ export declare const resolvePoolId: (hash: string) => string;
11
+ export declare const resolvePrivateKey: (words: string[]) => string;
12
+ export declare const resolveScriptRef: (script: PlutusScript | NativeScript) => string;
13
+ export declare const resolveSlotNo: (network: Network, milliseconds?: number) => string;
14
+ export declare const resolveRewardAddress: (bech32: string) => string;
15
+ export declare const resolveStakeKeyHash: (bech32: string) => string;
16
+ export declare const resolveTxFees: (txSize: number, minFeeA?: number, minFeeB?: number) => string;
17
+ export declare const resolveTxHash: (txHex: string) => string;
@@ -0,0 +1,4 @@
1
+ import type { Protocol, Quantity, Unit, UTxO } from '@mesh/types';
2
+ export declare const keepRelevant: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], minimumLovelaceRequired?: string) => UTxO[];
3
+ export declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
4
+ export declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
@@ -0,0 +1,15 @@
1
+ import type { DataSignature } from '@mesh/types';
2
+ import type { Address, PrivateKey } from '@mesh/core';
3
+ export declare const signMessage: (message: Message, signer: Signer) => {
4
+ coseKey: string;
5
+ coseSign1: string;
6
+ };
7
+ export declare const checkSignature: (message: string, signer: string, { key, signature }: DataSignature) => boolean;
8
+ export declare type Message = {
9
+ payload: string;
10
+ externalAAD?: string;
11
+ };
12
+ export declare type Signer = {
13
+ address: Address;
14
+ key: PrivateKey;
15
+ };