@unspent/phi
Version:
a collection of anyone can spend contracts
69 lines (66 loc) • 2.98 kB
text/typescript
import { Record } from "../contract/record/Record.js";
import { decodeNullDataScript } from "./util.js";
describe(`Faucet Class Tests`, () => {
test("Should a serialize a faucet", async () => {
const expectedReturn = [
new Uint8Array([98, 97, 110, 107]),
new Uint8Array([68]),
new Uint8Array([1]),
new Uint8Array([207, 128, 0]),
new Uint8Array([
242, 142, 142, 173, 231, 168, 142, 105, 233, 141, 182, 237, 131, 143,
229, 137, 151, 83, 71, 0,
]),
new Uint8Array([
118, 237, 177, 143, 237, 182, 148, 228, 148, 159, 9, 237, 186, 190, 237,
180, 160, 224, 169, 141, 21, 88, 236, 156, 128,
]),
new Uint8Array([
209, 147, 116, 44, 57, 197, 138, 36, 228, 185, 160, 91, 64, 214, 188,
227, 173, 141, 235, 136, 128,
]),
new Uint8Array([
242, 142, 142, 173, 231, 168, 142, 105, 233, 141, 182, 237, 131, 143,
229, 137, 151, 83, 71, 0,
]),
new Uint8Array([
118, 237, 177, 143, 237, 182, 148, 228, 148, 159, 9, 237, 186, 190, 237,
180, 160, 224, 169, 141, 21, 88, 236, 156, 128,
]),
new Uint8Array([
209, 147, 116, 44, 57, 197, 138, 36, 228, 185, 160, 91, 64, 214, 188,
227, 173, 141, 235, 136, 128,
]),
new Uint8Array([
234, 164, 134, 31, 219, 175, 233, 139, 177, 227, 176, 142, 102, 71, 12,
47, 229, 171, 189, 24,
]),
new Uint8Array([
242, 142, 142, 173, 231, 168, 142, 105, 233, 141, 182, 237, 131, 143,
229, 137, 151, 83, 71, 0,
]),
new Uint8Array([
235, 172, 139, 41, 84, 234, 151, 189, 231, 173, 150, 50, 230, 130, 138,
216, 168, 219, 157, 231, 128, 128,
]),
];
const d = new Uint8Array([
106, 4, 98, 97, 110, 107, 1, 68, 1, 1, 3, 207, 128, 0, 20, 242, 142, 142,
173, 231, 168, 142, 105, 233, 141, 182, 237, 131, 143, 229, 137, 151, 83,
71, 0, 25, 118, 237, 177, 143, 237, 182, 148, 228, 148, 159, 9, 237, 186,
190, 237, 180, 160, 224, 169, 141, 21, 88, 236, 156, 128, 21, 209, 147,
116, 44, 57, 197, 138, 36, 228, 185, 160, 91, 64, 214, 188, 227, 173, 141,
235, 136, 128, 20, 242, 142, 142, 173, 231, 168, 142, 105, 233, 141, 182,
237, 131, 143, 229, 137, 151, 83, 71, 0, 25, 118, 237, 177, 143, 237, 182,
148, 228, 148, 159, 9, 237, 186, 190, 237, 180, 160, 224, 169, 141, 21,
88, 236, 156, 128, 21, 209, 147, 116, 44, 57, 197, 138, 36, 228, 185, 160,
91, 64, 214, 188, 227, 173, 141, 235, 136, 128, 20, 234, 164, 134, 31,
219, 175, 233, 139, 177, 227, 176, 142, 102, 71, 12, 47, 229, 171, 189,
24, 20, 242, 142, 142, 173, 231, 168, 142, 105, 233, 141, 182, 237, 131,
143, 229, 137, 151, 83, 71, 0, 22, 235, 172, 139, 41, 84, 234, 151, 189,
231, 173, 150, 50, 230, 130, 138, 216, 168, 219, 157, 231, 128, 128,
]);
const r = decodeNullDataScript(d);
expect(r).toEqual(expectedReturn);
});
});