@meshsdk/common 1.0.0-alpha.1 → 1.0.0-alpha.12
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/cjs/builder/data/index.d.ts +4 -0
- package/dist/cjs/builder/data/index.js +20 -0
- package/dist/cjs/builder/data/mesh.d.ts +8 -0
- package/dist/cjs/builder/data/mesh.js +34 -0
- package/dist/cjs/builder/data/parser.d.ts +5 -0
- package/dist/cjs/builder/data/parser.js +11 -0
- package/dist/cjs/builder/data/plutus.d.ts +69 -0
- package/dist/cjs/builder/data/plutus.js +116 -0
- package/dist/cjs/builder/data/plutus.spec.d.ts +1 -0
- package/dist/cjs/builder/data/plutus.spec.js +98 -0
- package/dist/cjs/builder/data/time.d.ts +11 -0
- package/dist/cjs/builder/data/time.js +32 -0
- package/dist/cjs/builder/index.d.ts +3 -0
- package/dist/cjs/builder/index.js +19 -0
- package/dist/cjs/builder/serializer.d.ts +7 -0
- package/dist/cjs/builder/serializer.js +20 -0
- package/dist/cjs/builder/types.d.ts +142 -0
- package/dist/cjs/builder/types.js +2 -0
- package/dist/cjs/cip/CIP25.d.ts +19 -0
- package/dist/cjs/cip/CIP25.js +2 -0
- package/dist/cjs/cip/CIP27.d.ts +4 -0
- package/dist/cjs/cip/CIP27.js +2 -0
- package/dist/cjs/cip/CPS9.d.ts +2 -0
- package/dist/cjs/cip/CPS9.js +115 -0
- package/dist/cjs/cip/index.d.ts +3 -0
- package/dist/cjs/cip/index.js +19 -0
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/types/Account.d.ts +5 -0
- package/dist/cjs/types/Account.js +2 -0
- package/dist/cjs/types/AccountInfo.d.ts +7 -0
- package/dist/cjs/types/AccountInfo.js +2 -0
- package/dist/cjs/types/Action.d.ts +12 -0
- package/dist/cjs/types/Action.js +2 -0
- package/dist/cjs/types/Asset.d.ts +7 -0
- package/dist/cjs/types/Asset.js +17 -0
- package/dist/cjs/types/AssetExtended.d.ts +8 -0
- package/dist/cjs/types/AssetExtended.js +2 -0
- package/dist/cjs/types/AssetMetadata.d.ts +24 -0
- package/dist/cjs/types/AssetMetadata.js +2 -0
- package/dist/cjs/types/BlockInfo.d.ts +17 -0
- package/dist/cjs/types/BlockInfo.js +2 -0
- package/dist/cjs/types/Data.d.ts +4 -0
- package/dist/cjs/types/Data.js +2 -0
- package/dist/cjs/types/DataSignature.d.ts +4 -0
- package/dist/cjs/types/DataSignature.js +2 -0
- package/dist/cjs/types/Era.d.ts +1 -0
- package/dist/cjs/types/Era.js +2 -0
- package/dist/cjs/types/Mint.d.ts +10 -0
- package/dist/cjs/types/Mint.js +2 -0
- package/dist/cjs/types/NativeScript.d.ts +14 -0
- package/dist/cjs/types/NativeScript.js +2 -0
- package/dist/cjs/types/Network.d.ts +4 -0
- package/dist/cjs/types/Network.js +8 -0
- package/dist/cjs/types/PlutusScript.d.ts +5 -0
- package/dist/cjs/types/PlutusScript.js +2 -0
- package/dist/cjs/types/PoolParams.d.ts +16 -0
- package/dist/cjs/types/PoolParams.js +2 -0
- package/dist/cjs/types/Protocol.d.ts +22 -0
- package/dist/cjs/types/Protocol.js +2 -0
- package/dist/cjs/types/Recipient.d.ts +11 -0
- package/dist/cjs/types/Recipient.js +2 -0
- package/dist/cjs/types/Relay.d.ts +13 -0
- package/dist/cjs/types/Relay.js +2 -0
- package/dist/cjs/types/Token.d.ts +2 -0
- package/dist/cjs/types/Token.js +2 -0
- package/dist/cjs/types/TransactionInfo.d.ts +11 -0
- package/dist/cjs/types/TransactionInfo.js +2 -0
- package/dist/cjs/types/UTxO.d.ts +15 -0
- package/dist/cjs/types/UTxO.js +2 -0
- package/dist/cjs/types/Wallet.d.ts +5 -0
- package/dist/cjs/types/Wallet.js +2 -0
- package/dist/cjs/types/index.d.ts +22 -0
- package/dist/cjs/types/index.js +38 -0
- package/dist/mjs/builder/data/index.d.ts +4 -0
- package/dist/mjs/builder/data/index.js +4 -0
- package/dist/mjs/builder/data/mesh.d.ts +8 -0
- package/dist/mjs/builder/data/mesh.js +24 -0
- package/dist/mjs/builder/data/parser.d.ts +5 -0
- package/dist/mjs/builder/data/parser.js +4 -0
- package/dist/mjs/builder/data/plutus.d.ts +69 -0
- package/dist/mjs/builder/data/plutus.js +90 -0
- package/dist/mjs/builder/data/plutus.spec.d.ts +1 -0
- package/dist/mjs/builder/data/plutus.spec.js +96 -0
- package/dist/mjs/builder/data/time.d.ts +11 -0
- package/dist/mjs/builder/data/time.js +27 -0
- package/dist/mjs/builder/index.d.ts +3 -0
- package/dist/mjs/builder/index.js +3 -0
- package/dist/mjs/builder/serializer.d.ts +7 -0
- package/dist/mjs/builder/serializer.js +16 -0
- package/dist/mjs/builder/types.d.ts +142 -0
- package/dist/mjs/builder/types.js +1 -0
- package/dist/mjs/cip/CIP25.d.ts +19 -0
- package/dist/mjs/cip/CIP25.js +1 -0
- package/dist/mjs/cip/CIP27.d.ts +4 -0
- package/dist/mjs/cip/CIP27.js +1 -0
- package/dist/mjs/cip/CPS9.d.ts +2 -0
- package/dist/mjs/cip/CPS9.js +111 -0
- package/dist/mjs/cip/index.d.ts +3 -0
- package/dist/mjs/cip/index.js +3 -0
- package/dist/mjs/constants.d.ts +1 -1
- package/dist/mjs/index.d.ts +3 -0
- package/dist/mjs/index.js +3 -0
- package/dist/mjs/types/Account.d.ts +5 -0
- package/dist/mjs/types/Account.js +1 -0
- package/dist/mjs/types/AccountInfo.d.ts +7 -0
- package/dist/mjs/types/AccountInfo.js +1 -0
- package/dist/mjs/types/Action.d.ts +12 -0
- package/dist/mjs/types/Action.js +1 -0
- package/dist/mjs/types/Asset.d.ts +7 -0
- package/dist/mjs/types/Asset.js +13 -0
- package/dist/mjs/types/AssetExtended.d.ts +8 -0
- package/dist/mjs/types/AssetExtended.js +1 -0
- package/dist/mjs/types/AssetMetadata.d.ts +24 -0
- package/dist/mjs/types/AssetMetadata.js +1 -0
- package/dist/mjs/types/BlockInfo.d.ts +17 -0
- package/dist/mjs/types/BlockInfo.js +1 -0
- package/dist/mjs/types/Data.d.ts +4 -0
- package/dist/mjs/types/Data.js +1 -0
- package/dist/mjs/types/DataSignature.d.ts +4 -0
- package/dist/mjs/types/DataSignature.js +1 -0
- package/dist/mjs/types/Era.d.ts +1 -0
- package/dist/mjs/types/Era.js +1 -0
- package/dist/mjs/types/Mint.d.ts +10 -0
- package/dist/mjs/types/Mint.js +1 -0
- package/dist/mjs/types/NativeScript.d.ts +14 -0
- package/dist/mjs/types/NativeScript.js +1 -0
- package/dist/mjs/types/Network.d.ts +4 -0
- package/dist/mjs/types/Network.js +4 -0
- package/dist/mjs/types/PlutusScript.d.ts +5 -0
- package/dist/mjs/types/PlutusScript.js +1 -0
- package/dist/mjs/types/PoolParams.d.ts +16 -0
- package/dist/mjs/types/PoolParams.js +1 -0
- package/dist/mjs/types/Protocol.d.ts +22 -0
- package/dist/mjs/types/Protocol.js +1 -0
- package/dist/mjs/types/Recipient.d.ts +11 -0
- package/dist/mjs/types/Recipient.js +1 -0
- package/dist/mjs/types/Relay.d.ts +13 -0
- package/dist/mjs/types/Relay.js +1 -0
- package/dist/mjs/types/Token.d.ts +2 -0
- package/dist/mjs/types/Token.js +1 -0
- package/dist/mjs/types/TransactionInfo.d.ts +11 -0
- package/dist/mjs/types/TransactionInfo.js +1 -0
- package/dist/mjs/types/UTxO.d.ts +15 -0
- package/dist/mjs/types/UTxO.js +1 -0
- package/dist/mjs/types/Wallet.d.ts +5 -0
- package/dist/mjs/types/Wallet.js +1 -0
- package/dist/mjs/types/index.d.ts +22 -0
- package/dist/mjs/types/index.js +22 -0
- package/package.json +2 -2
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectUtxos = void 0;
|
|
4
|
+
const selectUtxos = (inputs, requiredAssets, threshold) => {
|
|
5
|
+
const totalRequiredAssets = new Map(requiredAssets);
|
|
6
|
+
totalRequiredAssets.set('lovelace', String(Number(totalRequiredAssets.get('lovelace')) + Number(threshold)));
|
|
7
|
+
const utxoMap = new Map();
|
|
8
|
+
for (let i = 0; i < inputs.length; i += 1) {
|
|
9
|
+
utxoMap.set(i, inputs[i]);
|
|
10
|
+
}
|
|
11
|
+
const selectedInputs = new Set();
|
|
12
|
+
const onlyLovelace = new Set();
|
|
13
|
+
const singletons = new Set();
|
|
14
|
+
const pairs = new Set();
|
|
15
|
+
const rest = new Set();
|
|
16
|
+
for (let i = 0; i < inputs.length; i += 1) {
|
|
17
|
+
switch (inputs[i].output.amount.length) {
|
|
18
|
+
case 1: {
|
|
19
|
+
onlyLovelace.add(i);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 2: {
|
|
23
|
+
singletons.add(i);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case 3: {
|
|
27
|
+
pairs.add(i);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
default: {
|
|
31
|
+
rest.add(i);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const addUtxoWithAssetAmount = (inputIndex, assetUnit, set) => {
|
|
37
|
+
const utxo = utxoMap.get(inputIndex);
|
|
38
|
+
if (!utxo)
|
|
39
|
+
return;
|
|
40
|
+
const amount = getAssetAmount(utxo, assetUnit);
|
|
41
|
+
if (Number(amount) > 0) {
|
|
42
|
+
selectedInputs.add(inputIndex);
|
|
43
|
+
set.delete(inputIndex);
|
|
44
|
+
for (const asset of utxo.output.amount) {
|
|
45
|
+
totalRequiredAssets.set(asset.unit, String(Number(totalRequiredAssets.get(asset.unit)) - Number(asset.quantity)));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
for (const assetUnit of totalRequiredAssets.keys()) {
|
|
50
|
+
if (assetUnit === 'lovelace')
|
|
51
|
+
continue;
|
|
52
|
+
for (const inputIndex of singletons) {
|
|
53
|
+
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
54
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
55
|
+
break;
|
|
56
|
+
addUtxoWithAssetAmount(inputIndex, assetUnit, singletons);
|
|
57
|
+
}
|
|
58
|
+
for (const inputIndex of pairs) {
|
|
59
|
+
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
60
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
61
|
+
break;
|
|
62
|
+
addUtxoWithAssetAmount(inputIndex, assetUnit, pairs);
|
|
63
|
+
}
|
|
64
|
+
for (const inputIndex of rest) {
|
|
65
|
+
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
66
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
67
|
+
break;
|
|
68
|
+
addUtxoWithAssetAmount(inputIndex, assetUnit, rest);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const inputIndex of onlyLovelace) {
|
|
72
|
+
const assetRequired = totalRequiredAssets.get('lovelace');
|
|
73
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
74
|
+
break;
|
|
75
|
+
addUtxoWithAssetAmount(inputIndex, 'lovelace', onlyLovelace);
|
|
76
|
+
}
|
|
77
|
+
for (const inputIndex of singletons) {
|
|
78
|
+
const assetRequired = totalRequiredAssets.get('lovelace');
|
|
79
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
80
|
+
break;
|
|
81
|
+
addUtxoWithAssetAmount(inputIndex, 'lovelace', singletons);
|
|
82
|
+
}
|
|
83
|
+
for (const inputIndex of pairs) {
|
|
84
|
+
const assetRequired = totalRequiredAssets.get('lovelace');
|
|
85
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
86
|
+
break;
|
|
87
|
+
addUtxoWithAssetAmount(inputIndex, 'lovelace', pairs);
|
|
88
|
+
}
|
|
89
|
+
for (const inputIndex of rest) {
|
|
90
|
+
const assetRequired = totalRequiredAssets.get('lovelace');
|
|
91
|
+
if (!assetRequired || Number(assetRequired) <= 0)
|
|
92
|
+
break;
|
|
93
|
+
addUtxoWithAssetAmount(inputIndex, 'lovelace', rest);
|
|
94
|
+
}
|
|
95
|
+
for (const assetUnit of totalRequiredAssets.keys()) {
|
|
96
|
+
if (Number(totalRequiredAssets.get(assetUnit)) > 0)
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
const selectedUtxos = [];
|
|
100
|
+
for (const inputIndex of selectedInputs) {
|
|
101
|
+
const utxo = utxoMap.get(inputIndex);
|
|
102
|
+
if (utxo) {
|
|
103
|
+
selectedUtxos.push(utxo);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return selectedUtxos;
|
|
107
|
+
};
|
|
108
|
+
exports.selectUtxos = selectUtxos;
|
|
109
|
+
const getAssetAmount = (utxo, assetUnit) => {
|
|
110
|
+
for (const utxoAsset of utxo.output.amount) {
|
|
111
|
+
if (utxoAsset.unit === assetUnit)
|
|
112
|
+
return utxoAsset.quantity;
|
|
113
|
+
}
|
|
114
|
+
return '0';
|
|
115
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./CPS9"), exports);
|
|
18
|
+
__exportStar(require("./CIP25"), exports);
|
|
19
|
+
__exportStar(require("./CIP27"), exports);
|
package/dist/cjs/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Budget, Era, LanguageVersion, Network, Protocol } from '
|
|
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;
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./cip"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./builder"), exports);
|
|
@@ -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,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,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,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 type Era = 'ALONZO' | 'BABBAGE';
|
|
@@ -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,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,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,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,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,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,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,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,8 @@
|
|
|
1
|
+
import { Data } from '../../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,24 @@
|
|
|
1
|
+
export const mConStr = (alternative, fields) => ({
|
|
2
|
+
alternative,
|
|
3
|
+
fields,
|
|
4
|
+
});
|
|
5
|
+
export const mConStr0 = (fields) => ({
|
|
6
|
+
alternative: 0,
|
|
7
|
+
fields,
|
|
8
|
+
});
|
|
9
|
+
export const mConStr1 = (fields) => ({
|
|
10
|
+
alternative: 1,
|
|
11
|
+
fields,
|
|
12
|
+
});
|
|
13
|
+
export const mConStr2 = (fields) => ({
|
|
14
|
+
alternative: 2,
|
|
15
|
+
fields,
|
|
16
|
+
});
|
|
17
|
+
export const mMaybeStakingHash = (stakeCredential) => {
|
|
18
|
+
if (stakeCredential === '') {
|
|
19
|
+
return mConStr1([]);
|
|
20
|
+
}
|
|
21
|
+
return mConStr0([mConStr0([mConStr0([stakeCredential])])]);
|
|
22
|
+
};
|
|
23
|
+
export const mPubKeyAddress = (bytes, stakeCredential) => mConStr0([{ alternative: 0, fields: [bytes] }, mMaybeStakingHash(stakeCredential || '')]);
|
|
24
|
+
export const mScriptAddress = (bytes, stakeCredential) => mConStr0([{ alternative: 1, fields: [bytes] }, mMaybeStakingHash(stakeCredential || '')]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const bytesToHex: (bytes: ArrayBuffer) => string;
|
|
3
|
+
export declare const hexToBytes: (hex: string) => Buffer;
|
|
4
|
+
export declare const stringToHex: (str: string) => string;
|
|
5
|
+
export declare const hexToString: (hex: string) => string;
|