@meshsdk/common 1.0.0-alpha.4 → 1.0.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.
- package/dist/cjs/builder/index.d.ts +2 -0
- package/dist/cjs/builder/index.js +18 -0
- package/dist/cjs/builder/serializer.d.ts +7 -0
- package/dist/cjs/builder/serializer.js +19 -0
- package/dist/cjs/builder/types.d.ts +128 -0
- package/dist/cjs/builder/types.js +2 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/mjs/builder/index.d.ts +2 -0
- package/dist/mjs/builder/index.js +2 -0
- package/dist/mjs/builder/serializer.d.ts +7 -0
- package/dist/mjs/builder/serializer.js +15 -0
- package/dist/mjs/builder/types.d.ts +128 -0
- package/dist/mjs/builder/types.js +1 -0
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
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("./serializer"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MeshTxBuilderBody } from './types';
|
|
2
|
+
import { Protocol } from '../types';
|
|
3
|
+
export declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
|
|
4
|
+
export interface IMeshSerializer {
|
|
5
|
+
serializeTxBody(txBody: MeshTxBuilderBody, protocolParams: Protocol): string;
|
|
6
|
+
addSigningKeys(txHex: string, signingKeys: string[]): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emptyTxBuilderBody = void 0;
|
|
4
|
+
const emptyTxBuilderBody = () => ({
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [],
|
|
7
|
+
extraInputs: [],
|
|
8
|
+
selectionThreshold: 0,
|
|
9
|
+
collaterals: [],
|
|
10
|
+
requiredSignatures: [],
|
|
11
|
+
referenceInputs: [],
|
|
12
|
+
mints: [],
|
|
13
|
+
changeAddress: '',
|
|
14
|
+
metadata: [],
|
|
15
|
+
validityRange: {},
|
|
16
|
+
certificates: [],
|
|
17
|
+
signingKey: [],
|
|
18
|
+
});
|
|
19
|
+
exports.emptyTxBuilderBody = emptyTxBuilderBody;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO, PoolParams } from '../types';
|
|
2
|
+
export type MeshTxBuilderBody = {
|
|
3
|
+
inputs: TxIn[];
|
|
4
|
+
outputs: Output[];
|
|
5
|
+
extraInputs: UTxO[];
|
|
6
|
+
selectionThreshold: number;
|
|
7
|
+
collaterals: PubKeyTxIn[];
|
|
8
|
+
requiredSignatures: string[];
|
|
9
|
+
referenceInputs: RefTxIn[];
|
|
10
|
+
mints: MintItem[];
|
|
11
|
+
changeAddress: string;
|
|
12
|
+
metadata: Metadata[];
|
|
13
|
+
validityRange: ValidityRange;
|
|
14
|
+
certificates: Certificate[];
|
|
15
|
+
signingKey: string[];
|
|
16
|
+
};
|
|
17
|
+
export type TxIn = PubKeyTxIn | ScriptTxIn;
|
|
18
|
+
export type PubKeyTxIn = {
|
|
19
|
+
type: 'PubKey';
|
|
20
|
+
txIn: TxInParameter;
|
|
21
|
+
};
|
|
22
|
+
export type TxInParameter = {
|
|
23
|
+
txHash: string;
|
|
24
|
+
txIndex: number;
|
|
25
|
+
amount?: Asset[];
|
|
26
|
+
address?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ScriptTxIn = {
|
|
29
|
+
type: 'Script';
|
|
30
|
+
txIn: TxInParameter;
|
|
31
|
+
scriptTxIn: ScriptTxInParameter;
|
|
32
|
+
};
|
|
33
|
+
export type ScriptTxInParameter = {
|
|
34
|
+
scriptSource?: {
|
|
35
|
+
type: 'Provided';
|
|
36
|
+
script: PlutusScript;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'Inline';
|
|
39
|
+
txInInfo: ScriptSourceInfo;
|
|
40
|
+
};
|
|
41
|
+
datumSource?: {
|
|
42
|
+
type: 'Provided';
|
|
43
|
+
data: BuilderData;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'Inline';
|
|
46
|
+
txHash: string;
|
|
47
|
+
txIndex: number;
|
|
48
|
+
};
|
|
49
|
+
redeemer?: Redeemer;
|
|
50
|
+
};
|
|
51
|
+
export type ScriptSourceInfo = {
|
|
52
|
+
txHash: string;
|
|
53
|
+
txIndex: number;
|
|
54
|
+
spendingScriptHash?: string;
|
|
55
|
+
version: LanguageVersion;
|
|
56
|
+
};
|
|
57
|
+
export type RefTxIn = {
|
|
58
|
+
txHash: string;
|
|
59
|
+
txIndex: number;
|
|
60
|
+
};
|
|
61
|
+
export type Output = {
|
|
62
|
+
address: string;
|
|
63
|
+
amount: Asset[];
|
|
64
|
+
datum?: {
|
|
65
|
+
type: 'Hash' | 'Inline';
|
|
66
|
+
data: BuilderData;
|
|
67
|
+
};
|
|
68
|
+
referenceScript?: PlutusScript;
|
|
69
|
+
};
|
|
70
|
+
export type MintItem = {
|
|
71
|
+
type: 'Plutus' | 'Native';
|
|
72
|
+
policyId: string;
|
|
73
|
+
assetName: string;
|
|
74
|
+
amount: string;
|
|
75
|
+
redeemer?: Redeemer;
|
|
76
|
+
scriptSource?: {
|
|
77
|
+
type: 'Provided';
|
|
78
|
+
script: PlutusScript;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'Reference Script';
|
|
81
|
+
txHash: string;
|
|
82
|
+
txIndex: number;
|
|
83
|
+
version: LanguageVersion;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type ValidityRange = {
|
|
87
|
+
invalidBefore?: number;
|
|
88
|
+
invalidHereafter?: number;
|
|
89
|
+
};
|
|
90
|
+
export type BuilderData = {
|
|
91
|
+
type: 'Mesh';
|
|
92
|
+
content: Data;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'JSON';
|
|
95
|
+
content: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'CBOR';
|
|
98
|
+
content: string;
|
|
99
|
+
};
|
|
100
|
+
export type Redeemer = {
|
|
101
|
+
data: BuilderData;
|
|
102
|
+
exUnits: Budget;
|
|
103
|
+
};
|
|
104
|
+
export type Metadata = {
|
|
105
|
+
tag: string;
|
|
106
|
+
metadata: object;
|
|
107
|
+
};
|
|
108
|
+
export 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
|
+
};
|
|
126
|
+
export type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
127
|
+
[P in K]: Required<T[P]>;
|
|
128
|
+
};
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MeshTxBuilderBody } from './types';
|
|
2
|
+
import { Protocol } from '../types';
|
|
3
|
+
export declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
|
|
4
|
+
export interface IMeshSerializer {
|
|
5
|
+
serializeTxBody(txBody: MeshTxBuilderBody, protocolParams: Protocol): string;
|
|
6
|
+
addSigningKeys(txHex: string, signingKeys: string[]): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const emptyTxBuilderBody = () => ({
|
|
2
|
+
inputs: [],
|
|
3
|
+
outputs: [],
|
|
4
|
+
extraInputs: [],
|
|
5
|
+
selectionThreshold: 0,
|
|
6
|
+
collaterals: [],
|
|
7
|
+
requiredSignatures: [],
|
|
8
|
+
referenceInputs: [],
|
|
9
|
+
mints: [],
|
|
10
|
+
changeAddress: '',
|
|
11
|
+
metadata: [],
|
|
12
|
+
validityRange: {},
|
|
13
|
+
certificates: [],
|
|
14
|
+
signingKey: [],
|
|
15
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO, PoolParams } from '../types';
|
|
2
|
+
export type MeshTxBuilderBody = {
|
|
3
|
+
inputs: TxIn[];
|
|
4
|
+
outputs: Output[];
|
|
5
|
+
extraInputs: UTxO[];
|
|
6
|
+
selectionThreshold: number;
|
|
7
|
+
collaterals: PubKeyTxIn[];
|
|
8
|
+
requiredSignatures: string[];
|
|
9
|
+
referenceInputs: RefTxIn[];
|
|
10
|
+
mints: MintItem[];
|
|
11
|
+
changeAddress: string;
|
|
12
|
+
metadata: Metadata[];
|
|
13
|
+
validityRange: ValidityRange;
|
|
14
|
+
certificates: Certificate[];
|
|
15
|
+
signingKey: string[];
|
|
16
|
+
};
|
|
17
|
+
export type TxIn = PubKeyTxIn | ScriptTxIn;
|
|
18
|
+
export type PubKeyTxIn = {
|
|
19
|
+
type: 'PubKey';
|
|
20
|
+
txIn: TxInParameter;
|
|
21
|
+
};
|
|
22
|
+
export type TxInParameter = {
|
|
23
|
+
txHash: string;
|
|
24
|
+
txIndex: number;
|
|
25
|
+
amount?: Asset[];
|
|
26
|
+
address?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ScriptTxIn = {
|
|
29
|
+
type: 'Script';
|
|
30
|
+
txIn: TxInParameter;
|
|
31
|
+
scriptTxIn: ScriptTxInParameter;
|
|
32
|
+
};
|
|
33
|
+
export type ScriptTxInParameter = {
|
|
34
|
+
scriptSource?: {
|
|
35
|
+
type: 'Provided';
|
|
36
|
+
script: PlutusScript;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'Inline';
|
|
39
|
+
txInInfo: ScriptSourceInfo;
|
|
40
|
+
};
|
|
41
|
+
datumSource?: {
|
|
42
|
+
type: 'Provided';
|
|
43
|
+
data: BuilderData;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'Inline';
|
|
46
|
+
txHash: string;
|
|
47
|
+
txIndex: number;
|
|
48
|
+
};
|
|
49
|
+
redeemer?: Redeemer;
|
|
50
|
+
};
|
|
51
|
+
export type ScriptSourceInfo = {
|
|
52
|
+
txHash: string;
|
|
53
|
+
txIndex: number;
|
|
54
|
+
spendingScriptHash?: string;
|
|
55
|
+
version: LanguageVersion;
|
|
56
|
+
};
|
|
57
|
+
export type RefTxIn = {
|
|
58
|
+
txHash: string;
|
|
59
|
+
txIndex: number;
|
|
60
|
+
};
|
|
61
|
+
export type Output = {
|
|
62
|
+
address: string;
|
|
63
|
+
amount: Asset[];
|
|
64
|
+
datum?: {
|
|
65
|
+
type: 'Hash' | 'Inline';
|
|
66
|
+
data: BuilderData;
|
|
67
|
+
};
|
|
68
|
+
referenceScript?: PlutusScript;
|
|
69
|
+
};
|
|
70
|
+
export type MintItem = {
|
|
71
|
+
type: 'Plutus' | 'Native';
|
|
72
|
+
policyId: string;
|
|
73
|
+
assetName: string;
|
|
74
|
+
amount: string;
|
|
75
|
+
redeemer?: Redeemer;
|
|
76
|
+
scriptSource?: {
|
|
77
|
+
type: 'Provided';
|
|
78
|
+
script: PlutusScript;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'Reference Script';
|
|
81
|
+
txHash: string;
|
|
82
|
+
txIndex: number;
|
|
83
|
+
version: LanguageVersion;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type ValidityRange = {
|
|
87
|
+
invalidBefore?: number;
|
|
88
|
+
invalidHereafter?: number;
|
|
89
|
+
};
|
|
90
|
+
export type BuilderData = {
|
|
91
|
+
type: 'Mesh';
|
|
92
|
+
content: Data;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'JSON';
|
|
95
|
+
content: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'CBOR';
|
|
98
|
+
content: string;
|
|
99
|
+
};
|
|
100
|
+
export type Redeemer = {
|
|
101
|
+
data: BuilderData;
|
|
102
|
+
exUnits: Budget;
|
|
103
|
+
};
|
|
104
|
+
export type Metadata = {
|
|
105
|
+
tag: string;
|
|
106
|
+
metadata: object;
|
|
107
|
+
};
|
|
108
|
+
export 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
|
+
};
|
|
126
|
+
export type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
127
|
+
[P in K]: Required<T[P]>;
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/mjs/index.d.ts
CHANGED
package/dist/mjs/index.js
CHANGED
package/package.json
CHANGED