@xyo-network/xl1-protocol 1.9.2 → 1.10.0
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/neutral/constants/defaultRewardRatio.d.ts +2 -0
- package/dist/neutral/constants/defaultRewardRatio.d.ts.map +1 -0
- package/dist/neutral/constants/index.d.ts +1 -0
- package/dist/neutral/constants/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +303 -86
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/isHydratedBoundWitness.d.ts +5 -2
- package/dist/neutral/isHydratedBoundWitness.d.ts.map +1 -1
- package/dist/neutral/network/NetworkId.d.ts +9 -2
- package/dist/neutral/network/NetworkId.d.ts.map +1 -1
- package/dist/neutral/provider/TransactionHelper.d.ts +3 -3
- package/dist/neutral/provider/TransactionHelper.d.ts.map +1 -1
- package/dist/neutral/provider/TransactionSubmitter.d.ts +2 -2
- package/dist/neutral/provider/TransactionSubmitter.d.ts.map +1 -1
- package/dist/neutral/provider/XyoRunner.d.ts +2 -2
- package/dist/neutral/provider/XyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/XyoViewer.d.ts +4 -4
- package/dist/neutral/provider/XyoViewer.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionReadRepository.d.ts +2 -2
- package/dist/neutral/repository/TransactionReadRepository.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionRepositoryIterator.d.ts +2 -2
- package/dist/neutral/repository/TransactionRepositoryIterator.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionWriteRepository.d.ts +2 -2
- package/dist/neutral/repository/TransactionWriteRepository.d.ts.map +1 -1
- package/dist/neutral/services/PendingTransactionsService.d.ts +2 -2
- package/dist/neutral/services/PendingTransactionsService.d.ts.map +1 -1
- package/dist/neutral/transaction/AnyHydratedTransaction.d.ts +6 -0
- package/dist/neutral/transaction/AnyHydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/transaction/HydratedTransaction.d.ts +5 -2
- package/dist/neutral/transaction/HydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/HydratedTransactionWithStorageMeta.d.ts +7 -0
- package/dist/neutral/transaction/HydratedTransactionWithStorageMeta.d.ts.map +1 -0
- package/dist/neutral/transaction/SignedHydratedTransaction.d.ts +6 -0
- package/dist/neutral/transaction/SignedHydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/transaction/SignedHydratedTransactionWithStorageMeta.d.ts +7 -0
- package/dist/neutral/transaction/SignedHydratedTransactionWithStorageMeta.d.ts.map +1 -0
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts +3 -12
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts.map +1 -1
- package/dist/neutral/transaction/TransactionBoundWitnessDeprecated.d.ts +18 -0
- package/dist/neutral/transaction/TransactionBoundWitnessDeprecated.d.ts.map +1 -0
- package/dist/neutral/transaction/TransactionFeesFields.d.ts +3 -1
- package/dist/neutral/transaction/TransactionFeesFields.d.ts.map +1 -1
- package/dist/neutral/transaction/UnsignedHydratedTransaction.d.ts +6 -0
- package/dist/neutral/transaction/UnsignedHydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/transaction/index.d.ts +6 -0
- package/dist/neutral/transaction/index.d.ts.map +1 -1
- package/dist/neutral/validation/transaction/HydratedTransactionValidationFunction.d.ts +2 -2
- package/dist/neutral/validation/transaction/HydratedTransactionValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/transaction/error.d.ts +2 -2
- package/dist/neutral/validation/transaction/error.d.ts.map +1 -1
- package/dist/neutral/xl1/AttoXL1.d.ts +9 -0
- package/dist/neutral/xl1/AttoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/FemtoXL1.d.ts +9 -0
- package/dist/neutral/xl1/FemtoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/MicroXL1.d.ts +9 -0
- package/dist/neutral/xl1/MicroXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/MilliXL1.d.ts +9 -0
- package/dist/neutral/xl1/MilliXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/NanoXL1.d.ts +9 -0
- package/dist/neutral/xl1/NanoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/PicoXL1.d.ts +9 -0
- package/dist/neutral/xl1/PicoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/XL1.d.ts +5 -38
- package/dist/neutral/xl1/XL1.d.ts.map +1 -1
- package/dist/neutral/xl1/XL1Units.d.ts +9 -0
- package/dist/neutral/xl1/XL1Units.d.ts.map +1 -0
- package/dist/neutral/xl1/index.d.ts +7 -0
- package/dist/neutral/xl1/index.d.ts.map +1 -1
- package/dist/neutral/xl1/isXL1Factory.d.ts +7 -0
- package/dist/neutral/xl1/isXL1Factory.d.ts.map +1 -0
- package/dist/neutral/xl1/xl1MaxValue.d.ts +2 -0
- package/dist/neutral/xl1/xl1MaxValue.d.ts.map +1 -0
- package/package.json +19 -18
- package/src/constants/defaultRewardRatio.ts +1 -0
- package/src/constants/index.ts +1 -0
- package/src/isHydratedBoundWitness.ts +24 -5
- package/src/network/NetworkId.ts +4 -2
- package/src/provider/TransactionHelper.ts +3 -3
- package/src/provider/TransactionSubmitter.ts +2 -2
- package/src/provider/XyoRunner.ts +2 -2
- package/src/provider/XyoViewer.ts +4 -4
- package/src/repository/TransactionReadRepository.ts +2 -2
- package/src/repository/TransactionRepositoryIterator.ts +2 -2
- package/src/repository/TransactionWriteRepository.ts +2 -2
- package/src/services/PendingTransactionsService.ts +2 -2
- package/src/transaction/AnyHydratedTransaction.ts +20 -0
- package/src/transaction/HydratedTransaction.ts +12 -4
- package/src/transaction/HydratedTransactionWithStorageMeta.ts +23 -0
- package/src/transaction/SignedHydratedTransaction.ts +21 -0
- package/src/transaction/SignedHydratedTransactionWithStorageMeta.ts +23 -0
- package/src/transaction/TransactionBoundWitness.ts +6 -35
- package/src/transaction/TransactionBoundWitnessDeprecated.ts +42 -0
- package/src/transaction/TransactionFeesFields.ts +22 -1
- package/src/transaction/UnsignedHydratedTransaction.ts +21 -0
- package/src/transaction/index.ts +6 -0
- package/src/validation/transaction/HydratedTransactionValidationFunction.ts +2 -2
- package/src/validation/transaction/error.ts +2 -2
- package/src/xl1/AttoXL1.ts +13 -0
- package/src/xl1/FemtoXL1.ts +14 -0
- package/src/xl1/MicroXL1.ts +14 -0
- package/src/xl1/MilliXL1.ts +14 -0
- package/src/xl1/NanoXL1.ts +14 -0
- package/src/xl1/PicoXL1.ts +14 -0
- package/src/xl1/XL1.ts +11 -56
- package/src/xl1/XL1Units.ts +25 -0
- package/src/xl1/index.ts +7 -0
- package/src/xl1/isXL1Factory.ts +45 -0
- package/src/xl1/xl1MaxValue.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultRewardRatio.d.ts","sourceRoot":"","sources":["../../../src/constants/defaultRewardRatio.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,EAAG,GAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -45,44 +45,259 @@ var TransferSchema = "network.xyo.transfer";
|
|
|
45
45
|
var isTransfer = isPayloadOfSchemaType3(TransferSchema);
|
|
46
46
|
var asTransfer = AsObjectFactory3.create(isTransfer);
|
|
47
47
|
|
|
48
|
-
// src/transaction/
|
|
49
|
-
import { AsObjectFactory as
|
|
48
|
+
// src/transaction/AnyHydratedTransaction.ts
|
|
49
|
+
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
50
50
|
|
|
51
51
|
// src/isHydratedBoundWitness.ts
|
|
52
|
-
import {
|
|
52
|
+
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
53
|
+
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
53
54
|
import { isAnyPayload as isAnyPayload2, isStorageMeta as isStorageMeta2 } from "@xyo-network/payload-model";
|
|
54
55
|
var isHydratedBoundWitness = (value) => {
|
|
55
|
-
return Array.isArray(value) && value.length === 2 &&
|
|
56
|
+
return Array.isArray(value) && value.length === 2 && isBoundWitness(value[0]) && Array.isArray(value[1]) && !value[1].some((item) => !isAnyPayload2(item));
|
|
57
|
+
};
|
|
58
|
+
var isHydratedBoundWitnessWithStorageMeta = (value) => {
|
|
59
|
+
return isHydratedBoundWitness(value) && isStorageMeta2(value[0]) && !value[1].some((item) => !isStorageMeta2(item));
|
|
56
60
|
};
|
|
61
|
+
var asHydratedBoundWitness = AsObjectFactory4.create(
|
|
62
|
+
isHydratedBoundWitness
|
|
63
|
+
);
|
|
64
|
+
var asHydratedBoundWitnessWithStorageMeta = AsObjectFactory4.create(
|
|
65
|
+
isHydratedBoundWitnessWithStorageMeta
|
|
66
|
+
);
|
|
57
67
|
|
|
58
68
|
// src/transaction/TransactionBoundWitness.ts
|
|
59
|
-
import {
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
import {
|
|
70
|
+
isAddress
|
|
71
|
+
} from "@xylabs/hex";
|
|
72
|
+
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
73
|
+
import { isBoundWitness as isBoundWitness2 } from "@xyo-network/boundwitness-model";
|
|
62
74
|
var isTransactionBoundWitness = (value) => {
|
|
63
75
|
const typedObj = value;
|
|
64
|
-
return
|
|
76
|
+
return isBoundWitness2(value) && isAddress(typedObj.chain) && typedObj.fees !== void 0 && typedObj.exp !== void 0 && typedObj.nbf !== void 0;
|
|
65
77
|
};
|
|
66
|
-
var
|
|
67
|
-
|
|
78
|
+
var asTransactionBoundWitness = AsObjectFactory5.create(isTransactionBoundWitness);
|
|
79
|
+
|
|
80
|
+
// src/transaction/AnyHydratedTransaction.ts
|
|
81
|
+
var isAnyHydratedTransaction = (value) => {
|
|
82
|
+
return isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0]);
|
|
68
83
|
};
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var isSignedTransactionBoundWitnessWithStorageMeta = (value) => isSignedTransactionBoundWitness(value) && isStorageMeta3(value);
|
|
73
|
-
var isSignedTransactionBoundWitnessWithHashStorageMeta = (value) => isSignedTransactionBoundWitness(value) && isHashStorageMeta(value);
|
|
74
|
-
var asTransactionBoundWitness = AsObjectFactory4.create(isTransactionBoundWitness);
|
|
75
|
-
var asTransactionBoundWitnessWithStorageMeta = AsObjectFactory4.create(isTransactionBoundWitnessWithStorageMeta);
|
|
76
|
-
var asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory4.create(isTransactionBoundWitnessWithHashStorageMeta);
|
|
84
|
+
var asAnyHydratedTransaction = AsObjectFactory6.create(
|
|
85
|
+
isAnyHydratedTransaction
|
|
86
|
+
);
|
|
77
87
|
|
|
78
88
|
// src/transaction/HydratedTransaction.ts
|
|
89
|
+
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
|
|
90
|
+
import { isSigned } from "@xyo-network/boundwitness-model";
|
|
91
|
+
import {
|
|
92
|
+
isStorageMeta as isStorageMeta3
|
|
93
|
+
} from "@xyo-network/payload-model";
|
|
79
94
|
var isHydratedTransaction = (value) => {
|
|
80
|
-
return isHydratedBoundWitness(value) &&
|
|
95
|
+
return isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0]) && isSigned(value[0]) && isStorageMeta3(value[0]);
|
|
81
96
|
};
|
|
82
|
-
var asHydratedTransaction =
|
|
97
|
+
var asHydratedTransaction = AsObjectFactory7.create(
|
|
98
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
83
99
|
isHydratedTransaction
|
|
84
100
|
);
|
|
85
101
|
|
|
102
|
+
// src/transaction/HydratedTransactionWithStorageMeta.ts
|
|
103
|
+
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
|
|
104
|
+
import {
|
|
105
|
+
isStorageMeta as isStorageMeta4
|
|
106
|
+
} from "@xyo-network/payload-model";
|
|
107
|
+
var isHydratedTransactionWithStorageMeta = (value) => {
|
|
108
|
+
return isAnyHydratedTransaction(value) && isStorageMeta4(value[0]) && !value[1].some((v) => !isStorageMeta4(v));
|
|
109
|
+
};
|
|
110
|
+
var asHydratedTransactionWithStorageMeta = AsObjectFactory8.create(
|
|
111
|
+
isHydratedTransactionWithStorageMeta
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// src/transaction/SignedHydratedTransaction.ts
|
|
115
|
+
import { AsObjectFactory as AsObjectFactory9 } from "@xylabs/object";
|
|
116
|
+
import { isSigned as isSigned2 } from "@xyo-network/boundwitness-model";
|
|
117
|
+
var isSignedHydratedTransaction = (value) => {
|
|
118
|
+
return isAnyHydratedTransaction(value) && isSigned2(value[0]);
|
|
119
|
+
};
|
|
120
|
+
var asSignedHydratedTransaction = AsObjectFactory9.create(
|
|
121
|
+
isSignedHydratedTransaction
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
// src/transaction/SignedHydratedTransactionWithStorageMeta.ts
|
|
125
|
+
import { AsObjectFactory as AsObjectFactory10 } from "@xylabs/object";
|
|
126
|
+
import {
|
|
127
|
+
isStorageMeta as isStorageMeta5
|
|
128
|
+
} from "@xyo-network/payload-model";
|
|
129
|
+
var isSignedHydratedTransactionWithStorageMeta = (value) => {
|
|
130
|
+
return isSignedHydratedTransaction(value) && isStorageMeta5(value[0]) && !value[1].some((v) => !isStorageMeta5(v));
|
|
131
|
+
};
|
|
132
|
+
var asSignedHydratedTransactionWithStorageMeta = AsObjectFactory10.create(
|
|
133
|
+
isSignedHydratedTransactionWithStorageMeta
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// src/transaction/TransactionBoundWitnessDeprecated.ts
|
|
137
|
+
import { AsObjectFactory as AsObjectFactory11 } from "@xylabs/object";
|
|
138
|
+
import { isSigned as isSigned3 } from "@xyo-network/boundwitness-model";
|
|
139
|
+
import { isHashStorageMeta, isStorageMeta as isStorageMeta6 } from "@xyo-network/payload-model";
|
|
140
|
+
var isSignedTransactionBoundWitness = (value) => {
|
|
141
|
+
return isTransactionBoundWitness(value) && isSigned3(value);
|
|
142
|
+
};
|
|
143
|
+
var isTransactionBoundWitnessWithStorageMeta = (value) => isTransactionBoundWitness(value) && isStorageMeta6(value);
|
|
144
|
+
var isTransactionBoundWitnessWithHashStorageMeta = (value) => isTransactionBoundWitness(value) && isHashStorageMeta(value);
|
|
145
|
+
var isSignedTransactionBoundWitnessWithStorageMeta = (value) => (
|
|
146
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
147
|
+
isSignedTransactionBoundWitness(value) && isStorageMeta6(value)
|
|
148
|
+
);
|
|
149
|
+
var isSignedTransactionBoundWitnessWithHashStorageMeta = (value) => (
|
|
150
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
151
|
+
isSignedTransactionBoundWitness(value) && isHashStorageMeta(value)
|
|
152
|
+
);
|
|
153
|
+
var asTransactionBoundWitnessWithStorageMeta = AsObjectFactory11.create(isTransactionBoundWitnessWithStorageMeta);
|
|
154
|
+
var asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory11.create(isTransactionBoundWitnessWithHashStorageMeta);
|
|
155
|
+
|
|
156
|
+
// src/transaction/TransactionFeesFields.ts
|
|
157
|
+
import { AsObjectFactory as AsObjectFactory12 } from "@xylabs/object";
|
|
158
|
+
import { isObject } from "@xylabs/typeof";
|
|
159
|
+
|
|
160
|
+
// src/xl1/isXL1Factory.ts
|
|
161
|
+
import z from "zod";
|
|
162
|
+
|
|
163
|
+
// src/xl1/xl1MaxValue.ts
|
|
164
|
+
var xl1MaxValue = (places) => 10n ** (18n - places) - 1n;
|
|
165
|
+
|
|
166
|
+
// src/xl1/isXL1Factory.ts
|
|
167
|
+
var isXL1Factory = (places) => (val) => {
|
|
168
|
+
if (typeof val !== "bigint") return false;
|
|
169
|
+
return val >= 0n && val <= xl1MaxValue(places);
|
|
170
|
+
};
|
|
171
|
+
var XL1ZodFactory = (places, name) => {
|
|
172
|
+
const is = isXL1Factory(places);
|
|
173
|
+
const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`;
|
|
174
|
+
return z.bigint().refine(
|
|
175
|
+
is,
|
|
176
|
+
{ message }
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
var XL1TransformZodFactory = (places, name) => {
|
|
180
|
+
const is = isXL1Factory(places);
|
|
181
|
+
const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`;
|
|
182
|
+
return z.union([z.bigint(), z.number(), z.string(), z.boolean()]).transform((val) => BigInt(val)).refine(
|
|
183
|
+
is,
|
|
184
|
+
{ message }
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
var asXL1Factory = (places) => {
|
|
188
|
+
const zod = XL1ZodFactory(places, "local");
|
|
189
|
+
return (val) => {
|
|
190
|
+
const result = zod.safeParse(val);
|
|
191
|
+
if (result.success) {
|
|
192
|
+
return result.data;
|
|
193
|
+
}
|
|
194
|
+
throw new Error(`Invalid value for ${places}, must be between 0 and ${xl1MaxValue(places)}`);
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
var toXL1Factory = (places) => {
|
|
198
|
+
const zod = XL1TransformZodFactory(places, "local");
|
|
199
|
+
return (val) => {
|
|
200
|
+
const result = zod.safeParse(val);
|
|
201
|
+
return result.success ? result.data : void 0;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/xl1/XL1Units.ts
|
|
206
|
+
var XL1Places = {
|
|
207
|
+
xl1: 18n,
|
|
208
|
+
milli: 15n,
|
|
209
|
+
micro: 12n,
|
|
210
|
+
nano: 9n,
|
|
211
|
+
pico: 6n,
|
|
212
|
+
femto: 3n,
|
|
213
|
+
atto: 0n
|
|
214
|
+
};
|
|
215
|
+
var AttoXL1ConvertFactor = {
|
|
216
|
+
xl1: 10n ** XL1Places.xl1,
|
|
217
|
+
milli: 10n ** XL1Places.milli,
|
|
218
|
+
micro: 10n ** XL1Places.micro,
|
|
219
|
+
nano: 10n ** XL1Places.nano,
|
|
220
|
+
pico: 10n ** XL1Places.pico,
|
|
221
|
+
femto: 10n ** XL1Places.femto,
|
|
222
|
+
atto: 10n ** XL1Places.atto
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// src/xl1/AttoXL1.ts
|
|
226
|
+
var AttoXL1MaxValue = xl1MaxValue(XL1Places.atto);
|
|
227
|
+
var isAttoXL1 = isXL1Factory(XL1Places.atto);
|
|
228
|
+
var asAttoXL1 = asXL1Factory(XL1Places.atto);
|
|
229
|
+
var toAttoXL1 = toXL1Factory(XL1Places.atto);
|
|
230
|
+
var AttoXL1 = asAttoXL1;
|
|
231
|
+
|
|
232
|
+
// src/xl1/FemtoXL1.ts
|
|
233
|
+
var FemtoXL1MaxValue = xl1MaxValue(XL1Places.femto);
|
|
234
|
+
var isFemtoXL1 = isXL1Factory(XL1Places.femto);
|
|
235
|
+
var asFemtoXL1 = asXL1Factory(XL1Places.femto);
|
|
236
|
+
var toFemtoXL1 = toXL1Factory(XL1Places.femto);
|
|
237
|
+
var FemtoXL1 = asFemtoXL1;
|
|
238
|
+
|
|
239
|
+
// src/xl1/MicroXL1.ts
|
|
240
|
+
var MicroXL1MaxValue = xl1MaxValue(XL1Places.micro);
|
|
241
|
+
var isMicroXL1 = isXL1Factory(XL1Places.micro);
|
|
242
|
+
var asMicroXL1 = asXL1Factory(XL1Places.micro);
|
|
243
|
+
var toMicroXL1 = toXL1Factory(XL1Places.micro);
|
|
244
|
+
var MicroXL1 = asMicroXL1;
|
|
245
|
+
|
|
246
|
+
// src/xl1/MilliXL1.ts
|
|
247
|
+
var MilliXL1MaxValue = xl1MaxValue(XL1Places.milli);
|
|
248
|
+
var isMilliXL1 = isXL1Factory(XL1Places.milli);
|
|
249
|
+
var asMilliXL1 = asXL1Factory(XL1Places.milli);
|
|
250
|
+
var toMilliXL1 = toXL1Factory(XL1Places.milli);
|
|
251
|
+
var MilliXL1 = asMilliXL1;
|
|
252
|
+
|
|
253
|
+
// src/xl1/NanoXL1.ts
|
|
254
|
+
var NanoXL1MaxValue = xl1MaxValue(XL1Places.nano);
|
|
255
|
+
var isNanoXL1 = isXL1Factory(XL1Places.nano);
|
|
256
|
+
var asNanoXL1 = asXL1Factory(XL1Places.nano);
|
|
257
|
+
var toNanoXL1 = toXL1Factory(XL1Places.nano);
|
|
258
|
+
var NanoXL1 = asNanoXL1;
|
|
259
|
+
|
|
260
|
+
// src/xl1/PicoXL1.ts
|
|
261
|
+
var PicoXL1MaxValue = xl1MaxValue(XL1Places.pico);
|
|
262
|
+
var isPicoXL1 = isXL1Factory(XL1Places.pico);
|
|
263
|
+
var asPicoXL1 = asXL1Factory(XL1Places.pico);
|
|
264
|
+
var toPicoXL1 = toXL1Factory(XL1Places.pico);
|
|
265
|
+
var PicoXL1 = asPicoXL1;
|
|
266
|
+
|
|
267
|
+
// src/xl1/XL1.ts
|
|
268
|
+
var XL1MaxValue = xl1MaxValue(XL1Places.xl1);
|
|
269
|
+
var isXL1 = isXL1Factory(XL1Places.xl1);
|
|
270
|
+
var asXL1 = asXL1Factory(XL1Places.xl1);
|
|
271
|
+
var toXL1 = toXL1Factory(XL1Places.xl1);
|
|
272
|
+
var XL1 = asXL1;
|
|
273
|
+
|
|
274
|
+
// src/transaction/TransactionFeesFields.ts
|
|
275
|
+
var isTransactionFeesBigInt = (value) => {
|
|
276
|
+
if (!isObject(value)) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
const {
|
|
280
|
+
base,
|
|
281
|
+
gasLimit,
|
|
282
|
+
gasPrice,
|
|
283
|
+
priority
|
|
284
|
+
} = value;
|
|
285
|
+
return isAttoXL1(base) && isAttoXL1(gasLimit) && isAttoXL1(gasPrice) && isAttoXL1(priority);
|
|
286
|
+
};
|
|
287
|
+
var asTransactionFeesBigInt = AsObjectFactory12.create(
|
|
288
|
+
isTransactionFeesBigInt
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
// src/transaction/UnsignedHydratedTransaction.ts
|
|
292
|
+
import { AsObjectFactory as AsObjectFactory13 } from "@xylabs/object";
|
|
293
|
+
import { isUnsigned } from "@xyo-network/boundwitness-model";
|
|
294
|
+
var isUnsignedHydratedTransaction = (value) => {
|
|
295
|
+
return isAnyHydratedTransaction(value) && isUnsigned(value[0]);
|
|
296
|
+
};
|
|
297
|
+
var asUnsignedHydratedTransaction = AsObjectFactory13.create(
|
|
298
|
+
isUnsignedHydratedTransaction
|
|
299
|
+
);
|
|
300
|
+
|
|
86
301
|
// src/block/AllowedBlockPayload.ts
|
|
87
302
|
var AllowedBlockPayloadSchemas = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema];
|
|
88
303
|
var isAllowedBlockPayloadSchema = (value) => {
|
|
@@ -97,82 +312,46 @@ var isAllowedBlockPayloadWithHashStorageMeta = (value) => {
|
|
|
97
312
|
|
|
98
313
|
// src/block/BlockBoundWitness.ts
|
|
99
314
|
import { isHex } from "@xylabs/hex";
|
|
100
|
-
import { AsObjectFactory as
|
|
101
|
-
import { isBoundWitness as
|
|
102
|
-
import { isHashStorageMeta as isHashStorageMeta3, isStorageMeta as
|
|
315
|
+
import { AsObjectFactory as AsObjectFactory14 } from "@xylabs/object";
|
|
316
|
+
import { isBoundWitness as isBoundWitness3, isSigned as isSigned4 } from "@xyo-network/boundwitness-model";
|
|
317
|
+
import { isHashStorageMeta as isHashStorageMeta3, isStorageMeta as isStorageMeta7 } from "@xyo-network/payload-model";
|
|
103
318
|
var isBlockBoundWitness = (value) => {
|
|
104
319
|
const typedObj = value;
|
|
105
|
-
return
|
|
320
|
+
return isBoundWitness3(value) && Number.isInteger(typedObj.block) && isHex(typedObj.chain);
|
|
106
321
|
};
|
|
107
322
|
var isSignedBlockBoundWitness = (value) => {
|
|
108
|
-
return isBlockBoundWitness(value) &&
|
|
323
|
+
return isBlockBoundWitness(value) && isSigned4(value);
|
|
109
324
|
};
|
|
110
325
|
var isBlockBoundWitnessWithStorageMeta = (value) => {
|
|
111
|
-
return isBlockBoundWitness(value) &&
|
|
326
|
+
return isBlockBoundWitness(value) && isStorageMeta7(value);
|
|
112
327
|
};
|
|
113
328
|
var isSignedBlockBoundWitnessWithStorageMeta = (value) => {
|
|
114
|
-
return isBlockBoundWitnessWithStorageMeta(value) &&
|
|
329
|
+
return isBlockBoundWitnessWithStorageMeta(value) && isSigned4(value);
|
|
115
330
|
};
|
|
116
331
|
var isBlockBoundWitnessWithHashStorageMeta = (value) => {
|
|
117
332
|
return isBlockBoundWitness(value) && isHashStorageMeta3(value);
|
|
118
333
|
};
|
|
119
334
|
var isSignedBlockBoundWitnessWithHashStorageMeta = (value) => {
|
|
120
|
-
return isBlockBoundWitnessWithHashStorageMeta(value) &&
|
|
121
|
-
};
|
|
122
|
-
var asBlockBoundWitness =
|
|
123
|
-
var asSignedBlockBoundWitness =
|
|
124
|
-
var asBlockBoundWitnessWithStorageMeta =
|
|
125
|
-
var asSignedBlockBoundWitnessWithStorageMeta =
|
|
126
|
-
var asBlockBoundWitnessWithHashStorageMeta =
|
|
127
|
-
var asSignedBlockBoundWitnessWithHashStorageMeta =
|
|
335
|
+
return isBlockBoundWitnessWithHashStorageMeta(value) && isSigned4(value);
|
|
336
|
+
};
|
|
337
|
+
var asBlockBoundWitness = AsObjectFactory14.create(isBlockBoundWitness);
|
|
338
|
+
var asSignedBlockBoundWitness = AsObjectFactory14.create(isSignedBlockBoundWitness);
|
|
339
|
+
var asBlockBoundWitnessWithStorageMeta = AsObjectFactory14.create(isBlockBoundWitnessWithStorageMeta);
|
|
340
|
+
var asSignedBlockBoundWitnessWithStorageMeta = AsObjectFactory14.create(isSignedBlockBoundWitnessWithStorageMeta);
|
|
341
|
+
var asBlockBoundWitnessWithHashStorageMeta = AsObjectFactory14.create(isBlockBoundWitnessWithHashStorageMeta);
|
|
342
|
+
var asSignedBlockBoundWitnessWithHashStorageMeta = AsObjectFactory14.create(isSignedBlockBoundWitnessWithHashStorageMeta);
|
|
128
343
|
|
|
129
344
|
// src/block/HydratedBlock.ts
|
|
130
|
-
import { AsObjectFactory as
|
|
345
|
+
import { AsObjectFactory as AsObjectFactory15 } from "@xylabs/object";
|
|
131
346
|
var isHydratedBlock = (value) => {
|
|
132
347
|
return isHydratedBoundWitness(value) && isBlockBoundWitnessWithStorageMeta(value[0]);
|
|
133
348
|
};
|
|
134
|
-
var asHydratedBlock =
|
|
349
|
+
var asHydratedBlock = AsObjectFactory15.create(
|
|
135
350
|
isHydratedBlock
|
|
136
351
|
);
|
|
137
352
|
|
|
138
|
-
// src/
|
|
139
|
-
var
|
|
140
|
-
var MilliXL1 = (value) => value;
|
|
141
|
-
var MicroXL1 = (value) => value;
|
|
142
|
-
var NanoXL1 = (value) => value;
|
|
143
|
-
var PicoXL1 = (value) => value;
|
|
144
|
-
var FemtoXL1 = (value) => value;
|
|
145
|
-
var AttoXL1 = (value) => value;
|
|
146
|
-
var XL1ConvertDict = {
|
|
147
|
-
xl1: 18,
|
|
148
|
-
milli: 15,
|
|
149
|
-
micro: 12,
|
|
150
|
-
nano: 9,
|
|
151
|
-
pico: 6,
|
|
152
|
-
femto: 3,
|
|
153
|
-
atto: 0
|
|
154
|
-
};
|
|
155
|
-
var XL1Places = {
|
|
156
|
-
xl1: 18n,
|
|
157
|
-
milli: 15n,
|
|
158
|
-
micro: 12n,
|
|
159
|
-
nano: 9n,
|
|
160
|
-
pico: 6n,
|
|
161
|
-
femto: 3n,
|
|
162
|
-
atto: 0n
|
|
163
|
-
};
|
|
164
|
-
var AttoXL1ConvertFactor = {
|
|
165
|
-
xl1: 10n ** XL1Places.xl1,
|
|
166
|
-
milli: 10n ** XL1Places.milli,
|
|
167
|
-
micro: 10n ** XL1Places.micro,
|
|
168
|
-
nano: 10n ** XL1Places.nano,
|
|
169
|
-
pico: 10n ** XL1Places.pico,
|
|
170
|
-
femto: 10n ** XL1Places.femto,
|
|
171
|
-
atto: 10n ** XL1Places.atto
|
|
172
|
-
};
|
|
173
|
-
function xl1ConvertFactor(unit) {
|
|
174
|
-
return 10n ** XL1Places[unit];
|
|
175
|
-
}
|
|
353
|
+
// src/constants/defaultRewardRatio.ts
|
|
354
|
+
var defaultRewardRatio = 0.5;
|
|
176
355
|
|
|
177
356
|
// src/constants/minTransactionFees.ts
|
|
178
357
|
var minTransactionFees = {
|
|
@@ -233,16 +412,16 @@ var XL1_PROTOCOL_VERSION = XL1_PROTOCOL_VERSION_MAJOR * 1e6 + XL1_PROTOCOL_VERSI
|
|
|
233
412
|
var XYO_ZERO_ADDRESS = "0000000000000000000000000000000000000000";
|
|
234
413
|
|
|
235
414
|
// src/fields/BlockNumber.ts
|
|
236
|
-
import { AsObjectFactory as
|
|
415
|
+
import { AsObjectFactory as AsObjectFactory16 } from "@xylabs/object";
|
|
237
416
|
import {
|
|
238
417
|
isPayloadOfSchemaType as isPayloadOfSchemaType4,
|
|
239
418
|
isPayloadOfSchemaTypeWithSources
|
|
240
419
|
} from "@xyo-network/payload-model";
|
|
241
420
|
var BlockNumberSchema = "network.xyo.chain.block.number";
|
|
242
421
|
var isBlockNumber = isPayloadOfSchemaType4(BlockNumberSchema);
|
|
243
|
-
var asBlockNumber =
|
|
422
|
+
var asBlockNumber = AsObjectFactory16.create(isBlockNumber);
|
|
244
423
|
var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
|
|
245
|
-
var asBlockNumberWithSources =
|
|
424
|
+
var asBlockNumberWithSources = AsObjectFactory16.create(isBlockNumberWithSources);
|
|
246
425
|
|
|
247
426
|
// src/network/Status.ts
|
|
248
427
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
|
|
@@ -258,15 +437,15 @@ var isDataLakeProvider = (value) => {
|
|
|
258
437
|
};
|
|
259
438
|
|
|
260
439
|
// src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
|
|
261
|
-
import { AsObjectFactory as
|
|
262
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType6, isStorageMeta as
|
|
440
|
+
import { AsObjectFactory as AsObjectFactory17 } from "@xylabs/object";
|
|
441
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType6, isStorageMeta as isStorageMeta8 } from "@xyo-network/payload-model";
|
|
263
442
|
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
264
443
|
var isChainIndexingServiceState = (payload) => {
|
|
265
444
|
return isPayloadOfSchemaType6(ChainIndexingServiceStateSchema)(payload);
|
|
266
445
|
};
|
|
267
|
-
var asChainIndexingServiceState =
|
|
268
|
-
var isChainIndexingServiceStateWithStorageMeta = (value) => isChainIndexingServiceState(value) &&
|
|
269
|
-
var asChainIndexingServiceStateWithStorageMeta =
|
|
446
|
+
var asChainIndexingServiceState = AsObjectFactory17.create(isChainIndexingServiceState);
|
|
447
|
+
var isChainIndexingServiceStateWithStorageMeta = (value) => isChainIndexingServiceState(value) && isStorageMeta8(value);
|
|
448
|
+
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory17.create(isChainIndexingServiceStateWithStorageMeta);
|
|
270
449
|
|
|
271
450
|
// src/validation/error.ts
|
|
272
451
|
import { isHash } from "@xylabs/hex";
|
|
@@ -349,12 +528,14 @@ export {
|
|
|
349
528
|
AllowedBlockPayloadSchemas,
|
|
350
529
|
AttoXL1,
|
|
351
530
|
AttoXL1ConvertFactor,
|
|
531
|
+
AttoXL1MaxValue,
|
|
352
532
|
BlockNumberSchema,
|
|
353
533
|
BlockValidationError,
|
|
354
534
|
BoundWitnessValidationError,
|
|
355
535
|
ChainIndexingServiceStateSchema,
|
|
356
536
|
ChainStakeIntentSchema,
|
|
357
537
|
FemtoXL1,
|
|
538
|
+
FemtoXL1MaxValue,
|
|
358
539
|
HashSchema,
|
|
359
540
|
HydratedBlockStateValidationError,
|
|
360
541
|
HydratedBlockValidationError,
|
|
@@ -362,16 +543,20 @@ export {
|
|
|
362
543
|
HydratedTransactionValidationError,
|
|
363
544
|
InBlockPayloadValidationError,
|
|
364
545
|
MicroXL1,
|
|
546
|
+
MicroXL1MaxValue,
|
|
365
547
|
MilliXL1,
|
|
548
|
+
MilliXL1MaxValue,
|
|
366
549
|
NanoXL1,
|
|
550
|
+
NanoXL1MaxValue,
|
|
367
551
|
NetworkStatusSchema,
|
|
368
552
|
PicoXL1,
|
|
553
|
+
PicoXL1MaxValue,
|
|
369
554
|
StepSizes,
|
|
370
555
|
TransactionGasCosts,
|
|
371
556
|
TransferSchema,
|
|
372
557
|
ValidationError,
|
|
373
558
|
XL1,
|
|
374
|
-
|
|
559
|
+
XL1MaxValue,
|
|
375
560
|
XL1Places,
|
|
376
561
|
XL1_PROTOCOL_VERSION,
|
|
377
562
|
XL1_PROTOCOL_VERSION_MAJOR,
|
|
@@ -379,6 +564,8 @@ export {
|
|
|
379
564
|
XL1_PROTOCOL_VERSION_PATCH,
|
|
380
565
|
XL1_PROTOCOL_VERSION_STRING,
|
|
381
566
|
XYO_ZERO_ADDRESS,
|
|
567
|
+
asAnyHydratedTransaction,
|
|
568
|
+
asAttoXL1,
|
|
382
569
|
asBlockBoundWitness,
|
|
383
570
|
asBlockBoundWitnessWithHashStorageMeta,
|
|
384
571
|
asBlockBoundWitnessWithStorageMeta,
|
|
@@ -388,23 +575,37 @@ export {
|
|
|
388
575
|
asChainIndexingServiceStateWithStorageMeta,
|
|
389
576
|
asChainStakeIntent,
|
|
390
577
|
asExecutable,
|
|
578
|
+
asFemtoXL1,
|
|
391
579
|
asHashPayload,
|
|
392
580
|
asHashPayloadWithStorageMeta,
|
|
393
581
|
asHydratedBlock,
|
|
394
582
|
asHydratedTransaction,
|
|
583
|
+
asHydratedTransactionWithStorageMeta,
|
|
584
|
+
asMicroXL1,
|
|
585
|
+
asMilliXL1,
|
|
586
|
+
asNanoXL1,
|
|
587
|
+
asPicoXL1,
|
|
395
588
|
asSignedBlockBoundWitness,
|
|
396
589
|
asSignedBlockBoundWitnessWithHashStorageMeta,
|
|
397
590
|
asSignedBlockBoundWitnessWithStorageMeta,
|
|
591
|
+
asSignedHydratedTransaction,
|
|
592
|
+
asSignedHydratedTransactionWithStorageMeta,
|
|
398
593
|
asTransactionBoundWitness,
|
|
399
594
|
asTransactionBoundWitnessWithHashStorageMeta,
|
|
400
595
|
asTransactionBoundWitnessWithStorageMeta,
|
|
596
|
+
asTransactionFeesBigInt,
|
|
401
597
|
asTransfer,
|
|
598
|
+
asUnsignedHydratedTransaction,
|
|
402
599
|
asValidStep,
|
|
600
|
+
asXL1,
|
|
601
|
+
defaultRewardRatio,
|
|
403
602
|
defaultTransactionFees,
|
|
404
603
|
hasFrom,
|
|
405
604
|
isAllowedBlockPayload,
|
|
406
605
|
isAllowedBlockPayloadSchema,
|
|
407
606
|
isAllowedBlockPayloadWithHashStorageMeta,
|
|
607
|
+
isAnyHydratedTransaction,
|
|
608
|
+
isAttoXL1,
|
|
408
609
|
isBlockBoundWitness,
|
|
409
610
|
isBlockBoundWitnessWithHashStorageMeta,
|
|
410
611
|
isBlockBoundWitnessWithStorageMeta,
|
|
@@ -419,6 +620,7 @@ export {
|
|
|
419
620
|
isDataLakeProvider,
|
|
420
621
|
isDataLakeViewer,
|
|
421
622
|
isExecutable,
|
|
623
|
+
isFemtoXL1,
|
|
422
624
|
isHashPayload,
|
|
423
625
|
isHydratedBlock,
|
|
424
626
|
isHydratedBlockStateValidationError,
|
|
@@ -426,23 +628,38 @@ export {
|
|
|
426
628
|
isHydratedBoundWitnessValidationError,
|
|
427
629
|
isHydratedTransaction,
|
|
428
630
|
isHydratedTransactionValidationError,
|
|
631
|
+
isHydratedTransactionWithStorageMeta,
|
|
429
632
|
isInBlockPayloadValidationError,
|
|
633
|
+
isMicroXL1,
|
|
634
|
+
isMilliXL1,
|
|
635
|
+
isNanoXL1,
|
|
430
636
|
isNetworkStatus,
|
|
431
|
-
|
|
637
|
+
isPicoXL1,
|
|
432
638
|
isSignedBlockBoundWitness,
|
|
433
639
|
isSignedBlockBoundWitnessWithHashStorageMeta,
|
|
434
640
|
isSignedBlockBoundWitnessWithStorageMeta,
|
|
641
|
+
isSignedHydratedTransaction,
|
|
642
|
+
isSignedHydratedTransactionWithStorageMeta,
|
|
435
643
|
isSignedTransactionBoundWitness,
|
|
436
644
|
isSignedTransactionBoundWitnessWithHashStorageMeta,
|
|
437
645
|
isSignedTransactionBoundWitnessWithStorageMeta,
|
|
438
646
|
isTransactionBoundWitness,
|
|
439
647
|
isTransactionBoundWitnessWithHashStorageMeta,
|
|
440
648
|
isTransactionBoundWitnessWithStorageMeta,
|
|
649
|
+
isTransactionFeesBigInt,
|
|
441
650
|
isTransfer,
|
|
651
|
+
isUnsignedHydratedTransaction,
|
|
442
652
|
isValidStep,
|
|
443
653
|
isValidationError,
|
|
654
|
+
isXL1,
|
|
444
655
|
minTransactionFees,
|
|
445
656
|
stepSize,
|
|
446
|
-
|
|
657
|
+
toAttoXL1,
|
|
658
|
+
toFemtoXL1,
|
|
659
|
+
toMicroXL1,
|
|
660
|
+
toMilliXL1,
|
|
661
|
+
toNanoXL1,
|
|
662
|
+
toPicoXL1,
|
|
663
|
+
toXL1
|
|
447
664
|
};
|
|
448
665
|
//# sourceMappingURL=index.mjs.map
|