@meshsdk/common 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (113) hide show
  1. package/dist/cjs/cip/CIP25.d.ts +19 -0
  2. package/dist/cjs/cip/CIP25.js +2 -0
  3. package/dist/cjs/cip/CIP27.d.ts +4 -0
  4. package/dist/cjs/cip/CIP27.js +2 -0
  5. package/dist/cjs/cip/CPS9.d.ts +1 -1
  6. package/dist/cjs/cip/index.d.ts +2 -0
  7. package/dist/cjs/cip/index.js +2 -0
  8. package/dist/cjs/constants.d.ts +1 -1
  9. package/dist/cjs/index.d.ts +1 -0
  10. package/dist/cjs/index.js +1 -0
  11. package/dist/cjs/types/Account.d.ts +5 -0
  12. package/dist/cjs/types/Account.js +2 -0
  13. package/dist/cjs/types/AccountInfo.d.ts +7 -0
  14. package/dist/cjs/types/AccountInfo.js +2 -0
  15. package/dist/cjs/types/Action.d.ts +12 -0
  16. package/dist/cjs/types/Action.js +2 -0
  17. package/dist/cjs/types/Asset.d.ts +7 -0
  18. package/dist/cjs/types/Asset.js +17 -0
  19. package/dist/cjs/types/AssetExtended.d.ts +8 -0
  20. package/dist/cjs/types/AssetExtended.js +2 -0
  21. package/dist/cjs/types/AssetMetadata.d.ts +24 -0
  22. package/dist/cjs/types/AssetMetadata.js +2 -0
  23. package/dist/cjs/types/BlockInfo.d.ts +17 -0
  24. package/dist/cjs/types/BlockInfo.js +2 -0
  25. package/dist/cjs/types/Data.d.ts +4 -0
  26. package/dist/cjs/types/Data.js +2 -0
  27. package/dist/cjs/types/DataSignature.d.ts +4 -0
  28. package/dist/cjs/types/DataSignature.js +2 -0
  29. package/dist/cjs/types/Era.d.ts +1 -0
  30. package/dist/cjs/types/Era.js +2 -0
  31. package/dist/cjs/types/Mint.d.ts +10 -0
  32. package/dist/cjs/types/Mint.js +2 -0
  33. package/dist/cjs/types/NativeScript.d.ts +14 -0
  34. package/dist/cjs/types/NativeScript.js +2 -0
  35. package/dist/cjs/types/Network.d.ts +4 -0
  36. package/dist/cjs/types/Network.js +8 -0
  37. package/dist/cjs/types/PlutusScript.d.ts +5 -0
  38. package/dist/cjs/types/PlutusScript.js +2 -0
  39. package/dist/cjs/types/PoolParams.d.ts +16 -0
  40. package/dist/cjs/types/PoolParams.js +2 -0
  41. package/dist/cjs/types/Protocol.d.ts +22 -0
  42. package/dist/cjs/types/Protocol.js +2 -0
  43. package/dist/cjs/types/Recipient.d.ts +11 -0
  44. package/dist/cjs/types/Recipient.js +2 -0
  45. package/dist/cjs/types/Relay.d.ts +13 -0
  46. package/dist/cjs/types/Relay.js +2 -0
  47. package/dist/cjs/types/Token.d.ts +2 -0
  48. package/dist/cjs/types/Token.js +2 -0
  49. package/dist/cjs/types/TransactionInfo.d.ts +11 -0
  50. package/dist/cjs/types/TransactionInfo.js +2 -0
  51. package/dist/cjs/types/UTxO.d.ts +15 -0
  52. package/dist/cjs/types/UTxO.js +2 -0
  53. package/dist/cjs/types/Wallet.d.ts +5 -0
  54. package/dist/cjs/types/Wallet.js +2 -0
  55. package/dist/cjs/types/index.d.ts +22 -0
  56. package/dist/cjs/types/index.js +38 -0
  57. package/dist/mjs/cip/CIP25.d.ts +19 -0
  58. package/dist/mjs/cip/CIP25.js +1 -0
  59. package/dist/mjs/cip/CIP27.d.ts +4 -0
  60. package/dist/mjs/cip/CIP27.js +1 -0
  61. package/dist/mjs/cip/CPS9.d.ts +1 -1
  62. package/dist/mjs/cip/index.d.ts +2 -0
  63. package/dist/mjs/cip/index.js +2 -0
  64. package/dist/mjs/constants.d.ts +1 -1
  65. package/dist/mjs/index.d.ts +1 -0
  66. package/dist/mjs/index.js +1 -0
  67. package/dist/mjs/types/Account.d.ts +5 -0
  68. package/dist/mjs/types/Account.js +1 -0
  69. package/dist/mjs/types/AccountInfo.d.ts +7 -0
  70. package/dist/mjs/types/AccountInfo.js +1 -0
  71. package/dist/mjs/types/Action.d.ts +12 -0
  72. package/dist/mjs/types/Action.js +1 -0
  73. package/dist/mjs/types/Asset.d.ts +7 -0
  74. package/dist/mjs/types/Asset.js +13 -0
  75. package/dist/mjs/types/AssetExtended.d.ts +8 -0
  76. package/dist/mjs/types/AssetExtended.js +1 -0
  77. package/dist/mjs/types/AssetMetadata.d.ts +24 -0
  78. package/dist/mjs/types/AssetMetadata.js +1 -0
  79. package/dist/mjs/types/BlockInfo.d.ts +17 -0
  80. package/dist/mjs/types/BlockInfo.js +1 -0
  81. package/dist/mjs/types/Data.d.ts +4 -0
  82. package/dist/mjs/types/Data.js +1 -0
  83. package/dist/mjs/types/DataSignature.d.ts +4 -0
  84. package/dist/mjs/types/DataSignature.js +1 -0
  85. package/dist/mjs/types/Era.d.ts +1 -0
  86. package/dist/mjs/types/Era.js +1 -0
  87. package/dist/mjs/types/Mint.d.ts +10 -0
  88. package/dist/mjs/types/Mint.js +1 -0
  89. package/dist/mjs/types/NativeScript.d.ts +14 -0
  90. package/dist/mjs/types/NativeScript.js +1 -0
  91. package/dist/mjs/types/Network.d.ts +4 -0
  92. package/dist/mjs/types/Network.js +4 -0
  93. package/dist/mjs/types/PlutusScript.d.ts +5 -0
  94. package/dist/mjs/types/PlutusScript.js +1 -0
  95. package/dist/mjs/types/PoolParams.d.ts +16 -0
  96. package/dist/mjs/types/PoolParams.js +1 -0
  97. package/dist/mjs/types/Protocol.d.ts +22 -0
  98. package/dist/mjs/types/Protocol.js +1 -0
  99. package/dist/mjs/types/Recipient.d.ts +11 -0
  100. package/dist/mjs/types/Recipient.js +1 -0
  101. package/dist/mjs/types/Relay.d.ts +13 -0
  102. package/dist/mjs/types/Relay.js +1 -0
  103. package/dist/mjs/types/Token.d.ts +2 -0
  104. package/dist/mjs/types/Token.js +1 -0
  105. package/dist/mjs/types/TransactionInfo.d.ts +11 -0
  106. package/dist/mjs/types/TransactionInfo.js +1 -0
  107. package/dist/mjs/types/UTxO.d.ts +15 -0
  108. package/dist/mjs/types/UTxO.js +1 -0
  109. package/dist/mjs/types/Wallet.d.ts +5 -0
  110. package/dist/mjs/types/Wallet.js +1 -0
  111. package/dist/mjs/types/index.d.ts +22 -0
  112. package/dist/mjs/types/index.js +22 -0
  113. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ export type MetadataStandard = {
2
+ name: string;
3
+ image: `${string}://${string}`;
4
+ mediaType?: `image/${string}`;
5
+ description?: string | string[];
6
+ instagram?: `https://instagram.com/${string}`;
7
+ twitter?: `https://twitter.com/${string}`;
8
+ discord?: `https://discord.gg/${string}`;
9
+ website?: `https://${string}`;
10
+ };
11
+ export type Files = {
12
+ files?: [
13
+ {
14
+ name: string;
15
+ src: `${string}://${string}`;
16
+ mediaType: `${string}/${string}`;
17
+ }
18
+ ];
19
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type RoyaltiesStandard = {
2
+ rate: string;
3
+ address: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- import type { Quantity, UTxO, Unit } from '@meshsdk/core';
1
+ import type { Quantity, UTxO, Unit } from '../types';
2
2
  export declare const selectUtxos: (inputs: UTxO[], requiredAssets: Map<Unit, Quantity>, threshold: Quantity) => UTxO[];
@@ -1 +1,3 @@
1
1
  export * from './CPS9';
2
+ export * from './CIP25';
3
+ export * from './CIP27';
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CPS9"), exports);
18
+ __exportStar(require("./CIP25"), exports);
19
+ __exportStar(require("./CIP27"), exports);
@@ -1,4 +1,4 @@
1
- import type { Budget, Era, LanguageVersion, Network, Protocol } from '@meshsdk/core';
1
+ import type { Budget, Era, LanguageVersion, Network, Protocol } from './types';
2
2
  export declare const DEFAULT_REDEEMER_BUDGET: Budget;
3
3
  export declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
4
4
  export declare const HARDENED_KEY_START = 2147483648;
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './cip';
3
+ export * from './types';
package/dist/cjs/index.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./constants"), exports);
18
18
  __exportStar(require("./cip"), exports);
19
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,5 @@
1
+ export type Account = {
2
+ baseAddress: string;
3
+ enterpriseAddress: string;
4
+ rewardAddress: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export type AccountInfo = {
2
+ active: boolean;
3
+ poolId?: string;
4
+ balance: string;
5
+ rewards: string;
6
+ withdrawals: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { Data } from './Data';
2
+ export type RedeemerTag = 'CERT' | 'MINT' | 'REWARD' | 'SPEND';
3
+ export type Budget = {
4
+ mem: number;
5
+ steps: number;
6
+ };
7
+ export type Action = {
8
+ data: Data;
9
+ index: number;
10
+ budget: Budget;
11
+ tag: RedeemerTag;
12
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export type Unit = string;
2
+ export type Quantity = string;
3
+ export type Asset = {
4
+ unit: Unit;
5
+ quantity: Quantity;
6
+ };
7
+ export declare const mergeAssets: (assets: Asset[]) => Asset[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeAssets = void 0;
4
+ const mergeAssets = (assets) => {
5
+ const merged = [];
6
+ assets.forEach((asset) => {
7
+ const existing = merged.find((a) => a.unit === asset.unit);
8
+ if (existing) {
9
+ existing.quantity = (parseInt(existing.quantity) + parseInt(asset.quantity)).toString();
10
+ }
11
+ else {
12
+ merged.push(asset);
13
+ }
14
+ });
15
+ return merged;
16
+ };
17
+ exports.mergeAssets = mergeAssets;
@@ -0,0 +1,8 @@
1
+ import { Quantity, Unit } from './Asset';
2
+ export type AssetExtended = {
3
+ unit: Unit;
4
+ policyId: string;
5
+ assetName: string;
6
+ fingerprint: string;
7
+ quantity: Quantity;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ import type { MetadataStandard, Files, RoyaltiesStandard } from '../cip';
2
+ export type AssetMetadata = FungibleAssetMetadata | NonFungibleAssetMetadata | RoyaltiesStandard;
3
+ export type FungibleAssetMetadata = MetadataStandard & {
4
+ ticker: string;
5
+ decimals: number;
6
+ version: `${number}.${number}`;
7
+ };
8
+ export type NonFungibleAssetMetadata = AudioAssetMetadata | ImageAssetMetadata | SmartAssetMetadata | VideoAssetMetadata;
9
+ type AudioAssetMetadata = MetadataStandard & Files;
10
+ export type ImageAssetMetadata = MetadataStandard & Files & {
11
+ artists?: [
12
+ {
13
+ name: string;
14
+ twitter?: `https://twitter.com/${string}`;
15
+ }
16
+ ];
17
+ attributes?: {
18
+ [key: string]: string;
19
+ };
20
+ traits?: string[];
21
+ };
22
+ type SmartAssetMetadata = MetadataStandard & Files;
23
+ type VideoAssetMetadata = MetadataStandard & Files;
24
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ export type BlockInfo = {
2
+ time: number;
3
+ hash: string;
4
+ slot: string;
5
+ epoch: number;
6
+ epochSlot: string;
7
+ slotLeader: string;
8
+ size: number;
9
+ txCount: number;
10
+ output: string;
11
+ fees: string;
12
+ previousBlock: string;
13
+ nextBlock: string;
14
+ confirmations: number;
15
+ operationalCertificate: string;
16
+ VRFKey: string;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type Data = string | number | bigint | Array<Data> | Map<Data, Data> | {
2
+ alternative: number;
3
+ fields: Array<Data>;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type DataSignature = {
2
+ signature: string;
3
+ key: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Era = 'ALONZO' | 'BABBAGE';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Quantity } from './Asset';
2
+ import { AssetMetadata } from './AssetMetadata';
3
+ import { Recipient } from './Recipient';
4
+ export type Mint = {
5
+ assetName: string;
6
+ assetQuantity: Quantity;
7
+ metadata: AssetMetadata;
8
+ recipient: Recipient;
9
+ label: '20' | '721' | '777' | `${number}`;
10
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ export type NativeScript = {
2
+ type: 'after' | 'before';
3
+ slot: string;
4
+ } | {
5
+ type: 'all' | 'any';
6
+ scripts: NativeScript[];
7
+ } | {
8
+ type: 'atLeast';
9
+ required: number;
10
+ scripts: NativeScript[];
11
+ } | {
12
+ type: 'sig';
13
+ keyHash: string;
14
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ declare const ALL_NETWORKS: readonly ["testnet", "preview", "preprod", "mainnet"];
2
+ export type Network = (typeof ALL_NETWORKS)[number];
3
+ export declare const isNetwork: (value: unknown) => value is "testnet" | "preview" | "preprod" | "mainnet";
4
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNetwork = void 0;
4
+ const ALL_NETWORKS = ['testnet', 'preview', 'preprod', 'mainnet'];
5
+ const isNetwork = (value) => {
6
+ return ALL_NETWORKS.includes(value);
7
+ };
8
+ exports.isNetwork = isNetwork;
@@ -0,0 +1,5 @@
1
+ export type PlutusScript = {
2
+ version: LanguageVersion;
3
+ code: string;
4
+ };
5
+ export type LanguageVersion = 'V1' | 'V2';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Relay } from './Relay';
2
+ export type PoolParams = {
3
+ VRFKeyHash: string;
4
+ operator: string;
5
+ pledge: string;
6
+ cost: string;
7
+ margin: number;
8
+ relays: Relay[];
9
+ owners: string[];
10
+ rewardAddress: string;
11
+ metadata?: PoolMetadata;
12
+ };
13
+ export type PoolMetadata = {
14
+ URL: string;
15
+ hash: string;
16
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ export type Protocol = {
2
+ epoch: number;
3
+ minFeeA: number;
4
+ minFeeB: number;
5
+ maxBlockSize: number;
6
+ maxTxSize: number;
7
+ maxBlockHeaderSize: number;
8
+ keyDeposit: string;
9
+ poolDeposit: string;
10
+ decentralisation: number;
11
+ minPoolCost: string;
12
+ priceMem: number;
13
+ priceStep: number;
14
+ maxTxExMem: string;
15
+ maxTxExSteps: string;
16
+ maxBlockExMem: string;
17
+ maxBlockExSteps: string;
18
+ maxValSize: string;
19
+ collateralPercent: number;
20
+ maxCollateralInputs: number;
21
+ coinsPerUTxOSize: string;
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { Data } from './Data';
2
+ import { NativeScript } from './NativeScript';
3
+ import { PlutusScript } from './PlutusScript';
4
+ export type Recipient = string | {
5
+ address: string;
6
+ datum?: {
7
+ value: Data;
8
+ inline?: boolean;
9
+ };
10
+ script?: PlutusScript | NativeScript;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export type Relay = {
2
+ type: 'SingleHostAddr';
3
+ IPV4?: string;
4
+ IPV6?: string;
5
+ port?: number;
6
+ } | {
7
+ type: 'SingleHostName';
8
+ domainName: string;
9
+ port?: number;
10
+ } | {
11
+ type: 'MultiHostName';
12
+ domainName: string;
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { SUPPORTED_TOKENS } from '../constants';
2
+ export type Token = keyof typeof SUPPORTED_TOKENS;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export type TransactionInfo = {
2
+ index: number;
3
+ block: string;
4
+ hash: string;
5
+ slot: string;
6
+ fees: string;
7
+ size: number;
8
+ deposit: string;
9
+ invalidBefore: string;
10
+ invalidAfter: string;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { Asset } from './Asset';
2
+ export type UTxO = {
3
+ input: {
4
+ outputIndex: number;
5
+ txHash: string;
6
+ };
7
+ output: {
8
+ address: string;
9
+ amount: Asset[];
10
+ dataHash?: string;
11
+ plutusData?: string;
12
+ scriptRef?: string;
13
+ scriptHash?: string;
14
+ };
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export type Wallet = {
2
+ name: string;
3
+ icon: string;
4
+ version: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ export * from './Account';
2
+ export * from './AccountInfo';
3
+ export * from './Action';
4
+ export * from './Asset';
5
+ export * from './AssetExtended';
6
+ export * from './AssetMetadata';
7
+ export * from './BlockInfo';
8
+ export * from './Data';
9
+ export * from './DataSignature';
10
+ export * from './Era';
11
+ export * from './Mint';
12
+ export * from './NativeScript';
13
+ export * from './Network';
14
+ export * from './PlutusScript';
15
+ export * from './PoolParams';
16
+ export * from './Protocol';
17
+ export * from './Recipient';
18
+ export * from './Relay';
19
+ export * from './Token';
20
+ export * from './TransactionInfo';
21
+ export * from './UTxO';
22
+ export * from './Wallet';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Account"), exports);
18
+ __exportStar(require("./AccountInfo"), exports);
19
+ __exportStar(require("./Action"), exports);
20
+ __exportStar(require("./Asset"), exports);
21
+ __exportStar(require("./AssetExtended"), exports);
22
+ __exportStar(require("./AssetMetadata"), exports);
23
+ __exportStar(require("./BlockInfo"), exports);
24
+ __exportStar(require("./Data"), exports);
25
+ __exportStar(require("./DataSignature"), exports);
26
+ __exportStar(require("./Era"), exports);
27
+ __exportStar(require("./Mint"), exports);
28
+ __exportStar(require("./NativeScript"), exports);
29
+ __exportStar(require("./Network"), exports);
30
+ __exportStar(require("./PlutusScript"), exports);
31
+ __exportStar(require("./PoolParams"), exports);
32
+ __exportStar(require("./Protocol"), exports);
33
+ __exportStar(require("./Recipient"), exports);
34
+ __exportStar(require("./Relay"), exports);
35
+ __exportStar(require("./Token"), exports);
36
+ __exportStar(require("./TransactionInfo"), exports);
37
+ __exportStar(require("./UTxO"), exports);
38
+ __exportStar(require("./Wallet"), exports);
@@ -0,0 +1,19 @@
1
+ export type MetadataStandard = {
2
+ name: string;
3
+ image: `${string}://${string}`;
4
+ mediaType?: `image/${string}`;
5
+ description?: string | string[];
6
+ instagram?: `https://instagram.com/${string}`;
7
+ twitter?: `https://twitter.com/${string}`;
8
+ discord?: `https://discord.gg/${string}`;
9
+ website?: `https://${string}`;
10
+ };
11
+ export type Files = {
12
+ files?: [
13
+ {
14
+ name: string;
15
+ src: `${string}://${string}`;
16
+ mediaType: `${string}/${string}`;
17
+ }
18
+ ];
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type RoyaltiesStandard = {
2
+ rate: string;
3
+ address: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- import type { Quantity, UTxO, Unit } from '@meshsdk/core';
1
+ import type { Quantity, UTxO, Unit } from '../types';
2
2
  export declare const selectUtxos: (inputs: UTxO[], requiredAssets: Map<Unit, Quantity>, threshold: Quantity) => UTxO[];
@@ -1 +1,3 @@
1
1
  export * from './CPS9';
2
+ export * from './CIP25';
3
+ export * from './CIP27';
@@ -1 +1,3 @@
1
1
  export * from './CPS9';
2
+ export * from './CIP25';
3
+ export * from './CIP27';
@@ -1,4 +1,4 @@
1
- import type { Budget, Era, LanguageVersion, Network, Protocol } from '@meshsdk/core';
1
+ import type { Budget, Era, LanguageVersion, Network, Protocol } from './types';
2
2
  export declare const DEFAULT_REDEEMER_BUDGET: Budget;
3
3
  export declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
4
4
  export declare const HARDENED_KEY_START = 2147483648;
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './cip';
3
+ export * from './types';
package/dist/mjs/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './cip';
3
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ export type Account = {
2
+ baseAddress: string;
3
+ enterpriseAddress: string;
4
+ rewardAddress: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type AccountInfo = {
2
+ active: boolean;
3
+ poolId?: string;
4
+ balance: string;
5
+ rewards: string;
6
+ withdrawals: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Data } from './Data';
2
+ export type RedeemerTag = 'CERT' | 'MINT' | 'REWARD' | 'SPEND';
3
+ export type Budget = {
4
+ mem: number;
5
+ steps: number;
6
+ };
7
+ export type Action = {
8
+ data: Data;
9
+ index: number;
10
+ budget: Budget;
11
+ tag: RedeemerTag;
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type Unit = string;
2
+ export type Quantity = string;
3
+ export type Asset = {
4
+ unit: Unit;
5
+ quantity: Quantity;
6
+ };
7
+ export declare const mergeAssets: (assets: Asset[]) => Asset[];
@@ -0,0 +1,13 @@
1
+ export const mergeAssets = (assets) => {
2
+ const merged = [];
3
+ assets.forEach((asset) => {
4
+ const existing = merged.find((a) => a.unit === asset.unit);
5
+ if (existing) {
6
+ existing.quantity = (parseInt(existing.quantity) + parseInt(asset.quantity)).toString();
7
+ }
8
+ else {
9
+ merged.push(asset);
10
+ }
11
+ });
12
+ return merged;
13
+ };
@@ -0,0 +1,8 @@
1
+ import { Quantity, Unit } from './Asset';
2
+ export type AssetExtended = {
3
+ unit: Unit;
4
+ policyId: string;
5
+ assetName: string;
6
+ fingerprint: string;
7
+ quantity: Quantity;
8
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { MetadataStandard, Files, RoyaltiesStandard } from '../cip';
2
+ export type AssetMetadata = FungibleAssetMetadata | NonFungibleAssetMetadata | RoyaltiesStandard;
3
+ export type FungibleAssetMetadata = MetadataStandard & {
4
+ ticker: string;
5
+ decimals: number;
6
+ version: `${number}.${number}`;
7
+ };
8
+ export type NonFungibleAssetMetadata = AudioAssetMetadata | ImageAssetMetadata | SmartAssetMetadata | VideoAssetMetadata;
9
+ type AudioAssetMetadata = MetadataStandard & Files;
10
+ export type ImageAssetMetadata = MetadataStandard & Files & {
11
+ artists?: [
12
+ {
13
+ name: string;
14
+ twitter?: `https://twitter.com/${string}`;
15
+ }
16
+ ];
17
+ attributes?: {
18
+ [key: string]: string;
19
+ };
20
+ traits?: string[];
21
+ };
22
+ type SmartAssetMetadata = MetadataStandard & Files;
23
+ type VideoAssetMetadata = MetadataStandard & Files;
24
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export type BlockInfo = {
2
+ time: number;
3
+ hash: string;
4
+ slot: string;
5
+ epoch: number;
6
+ epochSlot: string;
7
+ slotLeader: string;
8
+ size: number;
9
+ txCount: number;
10
+ output: string;
11
+ fees: string;
12
+ previousBlock: string;
13
+ nextBlock: string;
14
+ confirmations: number;
15
+ operationalCertificate: string;
16
+ VRFKey: string;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type Data = string | number | bigint | Array<Data> | Map<Data, Data> | {
2
+ alternative: number;
3
+ fields: Array<Data>;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type DataSignature = {
2
+ signature: string;
3
+ key: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type Era = 'ALONZO' | 'BABBAGE';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { Quantity } from './Asset';
2
+ import { AssetMetadata } from './AssetMetadata';
3
+ import { Recipient } from './Recipient';
4
+ export type Mint = {
5
+ assetName: string;
6
+ assetQuantity: Quantity;
7
+ metadata: AssetMetadata;
8
+ recipient: Recipient;
9
+ label: '20' | '721' | '777' | `${number}`;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ export type NativeScript = {
2
+ type: 'after' | 'before';
3
+ slot: string;
4
+ } | {
5
+ type: 'all' | 'any';
6
+ scripts: NativeScript[];
7
+ } | {
8
+ type: 'atLeast';
9
+ required: number;
10
+ scripts: NativeScript[];
11
+ } | {
12
+ type: 'sig';
13
+ keyHash: string;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ declare const ALL_NETWORKS: readonly ["testnet", "preview", "preprod", "mainnet"];
2
+ export type Network = (typeof ALL_NETWORKS)[number];
3
+ export declare const isNetwork: (value: unknown) => value is "testnet" | "preview" | "preprod" | "mainnet";
4
+ export {};
@@ -0,0 +1,4 @@
1
+ const ALL_NETWORKS = ['testnet', 'preview', 'preprod', 'mainnet'];
2
+ export const isNetwork = (value) => {
3
+ return ALL_NETWORKS.includes(value);
4
+ };
@@ -0,0 +1,5 @@
1
+ export type PlutusScript = {
2
+ version: LanguageVersion;
3
+ code: string;
4
+ };
5
+ export type LanguageVersion = 'V1' | 'V2';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Relay } from './Relay';
2
+ export type PoolParams = {
3
+ VRFKeyHash: string;
4
+ operator: string;
5
+ pledge: string;
6
+ cost: string;
7
+ margin: number;
8
+ relays: Relay[];
9
+ owners: string[];
10
+ rewardAddress: string;
11
+ metadata?: PoolMetadata;
12
+ };
13
+ export type PoolMetadata = {
14
+ URL: string;
15
+ hash: string;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ export type Protocol = {
2
+ epoch: number;
3
+ minFeeA: number;
4
+ minFeeB: number;
5
+ maxBlockSize: number;
6
+ maxTxSize: number;
7
+ maxBlockHeaderSize: number;
8
+ keyDeposit: string;
9
+ poolDeposit: string;
10
+ decentralisation: number;
11
+ minPoolCost: string;
12
+ priceMem: number;
13
+ priceStep: number;
14
+ maxTxExMem: string;
15
+ maxTxExSteps: string;
16
+ maxBlockExMem: string;
17
+ maxBlockExSteps: string;
18
+ maxValSize: string;
19
+ collateralPercent: number;
20
+ maxCollateralInputs: number;
21
+ coinsPerUTxOSize: string;
22
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Data } from './Data';
2
+ import { NativeScript } from './NativeScript';
3
+ import { PlutusScript } from './PlutusScript';
4
+ export type Recipient = string | {
5
+ address: string;
6
+ datum?: {
7
+ value: Data;
8
+ inline?: boolean;
9
+ };
10
+ script?: PlutusScript | NativeScript;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export type Relay = {
2
+ type: 'SingleHostAddr';
3
+ IPV4?: string;
4
+ IPV6?: string;
5
+ port?: number;
6
+ } | {
7
+ type: 'SingleHostName';
8
+ domainName: string;
9
+ port?: number;
10
+ } | {
11
+ type: 'MultiHostName';
12
+ domainName: string;
13
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { SUPPORTED_TOKENS } from '../constants';
2
+ export type Token = keyof typeof SUPPORTED_TOKENS;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export type TransactionInfo = {
2
+ index: number;
3
+ block: string;
4
+ hash: string;
5
+ slot: string;
6
+ fees: string;
7
+ size: number;
8
+ deposit: string;
9
+ invalidBefore: string;
10
+ invalidAfter: string;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Asset } from './Asset';
2
+ export type UTxO = {
3
+ input: {
4
+ outputIndex: number;
5
+ txHash: string;
6
+ };
7
+ output: {
8
+ address: string;
9
+ amount: Asset[];
10
+ dataHash?: string;
11
+ plutusData?: string;
12
+ scriptRef?: string;
13
+ scriptHash?: string;
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type Wallet = {
2
+ name: string;
3
+ icon: string;
4
+ version: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ export * from './Account';
2
+ export * from './AccountInfo';
3
+ export * from './Action';
4
+ export * from './Asset';
5
+ export * from './AssetExtended';
6
+ export * from './AssetMetadata';
7
+ export * from './BlockInfo';
8
+ export * from './Data';
9
+ export * from './DataSignature';
10
+ export * from './Era';
11
+ export * from './Mint';
12
+ export * from './NativeScript';
13
+ export * from './Network';
14
+ export * from './PlutusScript';
15
+ export * from './PoolParams';
16
+ export * from './Protocol';
17
+ export * from './Recipient';
18
+ export * from './Relay';
19
+ export * from './Token';
20
+ export * from './TransactionInfo';
21
+ export * from './UTxO';
22
+ export * from './Wallet';
@@ -0,0 +1,22 @@
1
+ export * from './Account';
2
+ export * from './AccountInfo';
3
+ export * from './Action';
4
+ export * from './Asset';
5
+ export * from './AssetExtended';
6
+ export * from './AssetMetadata';
7
+ export * from './BlockInfo';
8
+ export * from './Data';
9
+ export * from './DataSignature';
10
+ export * from './Era';
11
+ export * from './Mint';
12
+ export * from './NativeScript';
13
+ export * from './Network';
14
+ export * from './PlutusScript';
15
+ export * from './PoolParams';
16
+ export * from './Protocol';
17
+ export * from './Recipient';
18
+ export * from './Relay';
19
+ export * from './Token';
20
+ export * from './TransactionInfo';
21
+ export * from './UTxO';
22
+ export * from './Wallet';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meshsdk/common",
3
3
  "description": "Cardano common utils & constants for Mesh SDK",
4
- "version": "1.0.0-alpha.3",
4
+ "version": "1.0.0-alpha.4",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/mjs/index.js",