tigerbeetle-node 0.13.125 → 0.13.127
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/README.md +92 -70
- package/dist/benchmark.js +43 -35
- package/dist/benchmark.js.map +1 -1
- package/dist/bin/aarch64-linux-gnu/client.node +0 -0
- package/dist/bin/aarch64-linux-musl/client.node +0 -0
- package/dist/bin/aarch64-macos/client.node +0 -0
- package/dist/bin/x86_64-linux-gnu/client.node +0 -0
- package/dist/bin/x86_64-linux-musl/client.node +0 -0
- package/dist/bin/x86_64-macos/client.node +0 -0
- package/dist/bin/x86_64-windows/client.node +0 -0
- package/dist/bindings.d.ts +74 -69
- package/dist/bindings.js +62 -59
- package/dist/bindings.js.map +1 -1
- package/dist/test.js +65 -51
- package/dist/test.js.map +1 -1
- package/package.json +1 -1
- package/src/benchmark.ts +57 -48
- package/src/bindings.ts +140 -110
- package/src/node.zig +89 -62
- package/src/test.ts +68 -54
package/src/node.zig
CHANGED
|
@@ -184,27 +184,30 @@ fn decode_from_object(comptime T: type, env: c.napi_env, object: c.napi_value) !
|
|
|
184
184
|
.id = try translate.u128_from_object(env, object, "id"),
|
|
185
185
|
.debit_account_id = try translate.u128_from_object(env, object, "debit_account_id"),
|
|
186
186
|
.credit_account_id = try translate.u128_from_object(env, object, "credit_account_id"),
|
|
187
|
-
.
|
|
188
|
-
.reserved = try translate.u128_from_object(env, object, "reserved"),
|
|
187
|
+
.amount = try translate.u128_from_object(env, object, "amount"),
|
|
189
188
|
.pending_id = try translate.u128_from_object(env, object, "pending_id"),
|
|
190
|
-
.
|
|
189
|
+
.user_data_128 = try translate.u128_from_object(env, object, "user_data_128"),
|
|
190
|
+
.user_data_64 = try translate.u64_from_object(env, object, "user_data_64"),
|
|
191
|
+
.user_data_32 = try translate.u32_from_object(env, object, "user_data_32"),
|
|
192
|
+
.timeout = try translate.u32_from_object(env, object, "timeout"),
|
|
191
193
|
.ledger = try translate.u32_from_object(env, object, "ledger"),
|
|
192
194
|
.code = try translate.u16_from_object(env, object, "code"),
|
|
193
195
|
.flags = @as(TransferFlags, @bitCast(try translate.u16_from_object(env, object, "flags"))),
|
|
194
|
-
.amount = try translate.u64_from_object(env, object, "amount"),
|
|
195
196
|
.timestamp = try validate_timestamp(env, object),
|
|
196
197
|
},
|
|
197
198
|
Account => Account{
|
|
198
199
|
.id = try translate.u128_from_object(env, object, "id"),
|
|
199
|
-
.
|
|
200
|
-
.
|
|
200
|
+
.debits_pending = try translate.u128_from_object(env, object, "debits_pending"),
|
|
201
|
+
.debits_posted = try translate.u128_from_object(env, object, "debits_posted"),
|
|
202
|
+
.credits_pending = try translate.u128_from_object(env, object, "credits_pending"),
|
|
203
|
+
.credits_posted = try translate.u128_from_object(env, object, "credits_posted"),
|
|
204
|
+
.user_data_128 = try translate.u128_from_object(env, object, "user_data_128"),
|
|
205
|
+
.user_data_64 = try translate.u64_from_object(env, object, "user_data_64"),
|
|
206
|
+
.user_data_32 = try translate.u32_from_object(env, object, "user_data_32"),
|
|
207
|
+
.reserved = try translate.u32_from_object(env, object, "reserved"),
|
|
201
208
|
.ledger = try translate.u32_from_object(env, object, "ledger"),
|
|
202
209
|
.code = try translate.u16_from_object(env, object, "code"),
|
|
203
|
-
.flags = @
|
|
204
|
-
.debits_pending = try translate.u64_from_object(env, object, "debits_pending"),
|
|
205
|
-
.debits_posted = try translate.u64_from_object(env, object, "debits_posted"),
|
|
206
|
-
.credits_pending = try translate.u64_from_object(env, object, "credits_pending"),
|
|
207
|
-
.credits_posted = try translate.u64_from_object(env, object, "credits_posted"),
|
|
210
|
+
.flags = @bitCast(try translate.u16_from_object(env, object, "flags")),
|
|
208
211
|
.timestamp = try validate_timestamp(env, object),
|
|
209
212
|
},
|
|
210
213
|
u128 => try translate.u128_from_value(env, object, "lookup"),
|
|
@@ -320,73 +323,89 @@ fn encode_napi_results_array(
|
|
|
320
323
|
try translate.u128_into_object(
|
|
321
324
|
env,
|
|
322
325
|
napi_object,
|
|
323
|
-
"
|
|
324
|
-
result.
|
|
325
|
-
"Failed to set property \"
|
|
326
|
+
"debits_pending",
|
|
327
|
+
result.debits_pending,
|
|
328
|
+
"Failed to set property \"debits_pending\" of account lookup result.",
|
|
326
329
|
);
|
|
327
330
|
|
|
328
|
-
try translate.
|
|
331
|
+
try translate.u128_into_object(
|
|
329
332
|
env,
|
|
330
333
|
napi_object,
|
|
331
|
-
"
|
|
332
|
-
|
|
333
|
-
"Failed to set property \"
|
|
334
|
+
"debits_posted",
|
|
335
|
+
result.debits_posted,
|
|
336
|
+
"Failed to set property \"debits_posted\" of account lookup result.",
|
|
334
337
|
);
|
|
335
338
|
|
|
336
|
-
try translate.
|
|
339
|
+
try translate.u128_into_object(
|
|
337
340
|
env,
|
|
338
341
|
napi_object,
|
|
339
|
-
"
|
|
340
|
-
|
|
341
|
-
"Failed to set property \"
|
|
342
|
+
"credits_pending",
|
|
343
|
+
result.credits_pending,
|
|
344
|
+
"Failed to set property \"credits_pending\" of account lookup result.",
|
|
342
345
|
);
|
|
343
346
|
|
|
344
|
-
try translate.
|
|
347
|
+
try translate.u128_into_object(
|
|
345
348
|
env,
|
|
346
349
|
napi_object,
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
"Failed to set property \"
|
|
350
|
+
"credits_posted",
|
|
351
|
+
result.credits_posted,
|
|
352
|
+
"Failed to set property \"credits_posted\" of account lookup result.",
|
|
350
353
|
);
|
|
351
354
|
|
|
352
|
-
try translate.
|
|
355
|
+
try translate.u128_into_object(
|
|
353
356
|
env,
|
|
354
357
|
napi_object,
|
|
355
|
-
"
|
|
356
|
-
|
|
357
|
-
"Failed to set property \"
|
|
358
|
+
"user_data_128",
|
|
359
|
+
result.user_data_128,
|
|
360
|
+
"Failed to set property \"user_data_128\" of account lookup result.",
|
|
358
361
|
);
|
|
359
362
|
|
|
360
363
|
try translate.u64_into_object(
|
|
361
364
|
env,
|
|
362
365
|
napi_object,
|
|
363
|
-
"
|
|
364
|
-
result.
|
|
365
|
-
"Failed to set property \"
|
|
366
|
+
"user_data_64",
|
|
367
|
+
result.user_data_64,
|
|
368
|
+
"Failed to set property \"user_data_64\" of account lookup result.",
|
|
366
369
|
);
|
|
367
370
|
|
|
368
|
-
try translate.
|
|
371
|
+
try translate.u32_into_object(
|
|
369
372
|
env,
|
|
370
373
|
napi_object,
|
|
371
|
-
"
|
|
372
|
-
result.
|
|
373
|
-
"Failed to set property \"
|
|
374
|
+
"user_data_32",
|
|
375
|
+
result.user_data_32,
|
|
376
|
+
"Failed to set property \"user_data_32\" of account lookup result.",
|
|
374
377
|
);
|
|
375
378
|
|
|
376
|
-
try translate.
|
|
379
|
+
try translate.u32_into_object(
|
|
377
380
|
env,
|
|
378
381
|
napi_object,
|
|
379
|
-
"
|
|
380
|
-
result.
|
|
381
|
-
"Failed to set property \"
|
|
382
|
+
"reserved",
|
|
383
|
+
result.reserved,
|
|
384
|
+
"Failed to set property \"reserved\" of account lookup result.",
|
|
382
385
|
);
|
|
383
386
|
|
|
384
|
-
try translate.
|
|
387
|
+
try translate.u32_into_object(
|
|
385
388
|
env,
|
|
386
389
|
napi_object,
|
|
387
|
-
"
|
|
388
|
-
result.
|
|
389
|
-
"Failed to set property \"
|
|
390
|
+
"ledger",
|
|
391
|
+
@as(u32, @intCast(result.ledger)),
|
|
392
|
+
"Failed to set property \"ledger\" of account lookup result.",
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
try translate.u16_into_object(
|
|
396
|
+
env,
|
|
397
|
+
napi_object,
|
|
398
|
+
"code",
|
|
399
|
+
@as(u16, @intCast(result.code)),
|
|
400
|
+
"Failed to set property \"code\" of account lookup result.",
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
try translate.u16_into_object(
|
|
404
|
+
env,
|
|
405
|
+
napi_object,
|
|
406
|
+
"flags",
|
|
407
|
+
@as(u16, @bitCast(result.flags)),
|
|
408
|
+
"Failed to set property \"flags\" of account lookup result.",
|
|
390
409
|
);
|
|
391
410
|
|
|
392
411
|
try translate.u64_into_object(
|
|
@@ -442,28 +461,44 @@ fn encode_napi_results_array(
|
|
|
442
461
|
try translate.u128_into_object(
|
|
443
462
|
env,
|
|
444
463
|
napi_object,
|
|
445
|
-
"
|
|
446
|
-
result.
|
|
447
|
-
"Failed to set property \"
|
|
464
|
+
"amount",
|
|
465
|
+
result.amount,
|
|
466
|
+
"Failed to set property \"amount\" of transfer lookup result.",
|
|
448
467
|
);
|
|
449
468
|
|
|
450
469
|
try translate.u128_into_object(
|
|
451
470
|
env,
|
|
452
471
|
napi_object,
|
|
453
|
-
"
|
|
454
|
-
result.
|
|
455
|
-
"Failed to set property \"
|
|
472
|
+
"pending_id",
|
|
473
|
+
result.pending_id,
|
|
474
|
+
"Failed to set property \"pending_id\" of transfer lookup result.",
|
|
456
475
|
);
|
|
457
476
|
|
|
458
477
|
try translate.u128_into_object(
|
|
459
478
|
env,
|
|
460
479
|
napi_object,
|
|
461
|
-
"
|
|
462
|
-
result.
|
|
463
|
-
"Failed to set property \"
|
|
480
|
+
"user_data_128",
|
|
481
|
+
result.user_data_128,
|
|
482
|
+
"Failed to set property \"user_data_128\" of transfer lookup result.",
|
|
464
483
|
);
|
|
465
484
|
|
|
466
485
|
try translate.u64_into_object(
|
|
486
|
+
env,
|
|
487
|
+
napi_object,
|
|
488
|
+
"user_data_64",
|
|
489
|
+
result.user_data_64,
|
|
490
|
+
"Failed to set property \"user_data_64\" of transfer lookup result.",
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
try translate.u32_into_object(
|
|
494
|
+
env,
|
|
495
|
+
napi_object,
|
|
496
|
+
"user_data_32",
|
|
497
|
+
result.user_data_32,
|
|
498
|
+
"Failed to set property \"user_data_32\" of transfer lookup result.",
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
try translate.u32_into_object(
|
|
467
502
|
env,
|
|
468
503
|
napi_object,
|
|
469
504
|
"timeout",
|
|
@@ -495,14 +530,6 @@ fn encode_napi_results_array(
|
|
|
495
530
|
"Failed to set property \"flags\" of transfer lookup result.",
|
|
496
531
|
);
|
|
497
532
|
|
|
498
|
-
try translate.u64_into_object(
|
|
499
|
-
env,
|
|
500
|
-
napi_object,
|
|
501
|
-
"amount",
|
|
502
|
-
result.amount,
|
|
503
|
-
"Failed to set property \"amount\" of transfer lookup result.",
|
|
504
|
-
);
|
|
505
|
-
|
|
506
533
|
try translate.u64_into_object(
|
|
507
534
|
env,
|
|
508
535
|
napi_object,
|
package/src/test.ts
CHANGED
|
@@ -18,28 +18,32 @@ const Zeroed32Bytes = Buffer.alloc(32, 0)
|
|
|
18
18
|
const Zeroed48Bytes = Buffer.alloc(48, 0)
|
|
19
19
|
const accountA: Account = {
|
|
20
20
|
id: 17n,
|
|
21
|
-
user_data: 0n,
|
|
22
|
-
reserved: Zeroed48Bytes,
|
|
23
|
-
ledger: 1,
|
|
24
|
-
code: 718,
|
|
25
|
-
flags: 0,
|
|
26
21
|
debits_pending: 0n,
|
|
27
22
|
debits_posted: 0n,
|
|
28
23
|
credits_pending: 0n,
|
|
29
|
-
credits_posted: 0n,
|
|
24
|
+
credits_posted: 0n,
|
|
25
|
+
user_data_128: 0n,
|
|
26
|
+
user_data_64: 0n,
|
|
27
|
+
user_data_32: 0,
|
|
28
|
+
reserved: 0,
|
|
29
|
+
ledger: 1,
|
|
30
|
+
code: 718,
|
|
31
|
+
flags: 0,
|
|
30
32
|
timestamp: 0n // this will be set correctly by the TigerBeetle server
|
|
31
33
|
}
|
|
32
34
|
const accountB: Account = {
|
|
33
35
|
id: 19n,
|
|
34
|
-
user_data: 0n,
|
|
35
|
-
reserved: Zeroed48Bytes,
|
|
36
|
-
ledger: 1,
|
|
37
|
-
code: 719,
|
|
38
|
-
flags: 0,
|
|
39
36
|
debits_pending: 0n,
|
|
40
37
|
debits_posted: 0n,
|
|
41
38
|
credits_pending: 0n,
|
|
42
|
-
credits_posted: 0n,
|
|
39
|
+
credits_posted: 0n,
|
|
40
|
+
user_data_128: 0n,
|
|
41
|
+
user_data_64: 0n,
|
|
42
|
+
user_data_32: 0,
|
|
43
|
+
reserved: 0,
|
|
44
|
+
ledger: 1,
|
|
45
|
+
code: 719,
|
|
46
|
+
flags: 0,
|
|
43
47
|
timestamp: 0n // this will be set correctly by the TigerBeetle server
|
|
44
48
|
}
|
|
45
49
|
|
|
@@ -85,28 +89,30 @@ test('can lookup accounts', async (): Promise<void> => {
|
|
|
85
89
|
assert.strictEqual(accounts.length, 2)
|
|
86
90
|
const account1 = accounts[0]
|
|
87
91
|
assert.strictEqual(account1.id, 17n)
|
|
88
|
-
assert.ok(account1.reserved.equals(Zeroed48Bytes))
|
|
89
|
-
assert.strictEqual(account1.user_data, 0n)
|
|
90
|
-
assert.strictEqual(account1.code, 718)
|
|
91
|
-
assert.strictEqual(account1.ledger, 1)
|
|
92
|
-
assert.strictEqual(account1.flags, 0)
|
|
93
92
|
assert.strictEqual(account1.credits_posted, 0n)
|
|
94
93
|
assert.strictEqual(account1.credits_pending, 0n)
|
|
95
94
|
assert.strictEqual(account1.debits_posted, 0n)
|
|
96
|
-
assert.strictEqual(account1.debits_pending, 0n)
|
|
95
|
+
assert.strictEqual(account1.debits_pending, 0n)
|
|
96
|
+
assert.strictEqual(account1.user_data_128, 0n)
|
|
97
|
+
assert.strictEqual(account1.user_data_64, 0n)
|
|
98
|
+
assert.strictEqual(account1.user_data_32, 0)
|
|
99
|
+
assert.strictEqual(account1.code, 718)
|
|
100
|
+
assert.strictEqual(account1.ledger, 1)
|
|
101
|
+
assert.strictEqual(account1.flags, 0)
|
|
97
102
|
assert.ok(account1.timestamp > 0n)
|
|
98
103
|
|
|
99
104
|
const account2 = accounts[1]
|
|
100
105
|
assert.strictEqual(account2.id, 19n)
|
|
101
|
-
assert.ok(account2.reserved.equals(Zeroed48Bytes))
|
|
102
|
-
assert.strictEqual(account2.user_data, 0n)
|
|
103
|
-
assert.strictEqual(account2.code, 719)
|
|
104
|
-
assert.strictEqual(account2.ledger, 1)
|
|
105
|
-
assert.strictEqual(account2.flags, 0)
|
|
106
106
|
assert.strictEqual(account2.credits_posted, 0n)
|
|
107
107
|
assert.strictEqual(account2.credits_pending, 0n)
|
|
108
108
|
assert.strictEqual(account2.debits_posted, 0n)
|
|
109
109
|
assert.strictEqual(account2.debits_pending, 0n)
|
|
110
|
+
assert.strictEqual(account2.user_data_128, 0n)
|
|
111
|
+
assert.strictEqual(account2.user_data_64, 0n)
|
|
112
|
+
assert.strictEqual(account2.user_data_32, 0)
|
|
113
|
+
assert.strictEqual(account2.code, 719)
|
|
114
|
+
assert.strictEqual(account2.ledger, 1)
|
|
115
|
+
assert.strictEqual(account2.flags, 0)
|
|
110
116
|
assert.ok(account2.timestamp > 0n)
|
|
111
117
|
})
|
|
112
118
|
|
|
@@ -115,14 +121,15 @@ test('can create a transfer', async (): Promise<void> => {
|
|
|
115
121
|
id: 1n,
|
|
116
122
|
debit_account_id: accountB.id,
|
|
117
123
|
credit_account_id: accountA.id,
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
amount: 100n,
|
|
125
|
+
user_data_128: 0n,
|
|
126
|
+
user_data_64: 0n,
|
|
127
|
+
user_data_32: 0,
|
|
120
128
|
pending_id: 0n,
|
|
121
|
-
timeout:
|
|
129
|
+
timeout: 0,
|
|
122
130
|
ledger: 1,
|
|
123
131
|
code: 1,
|
|
124
132
|
flags: 0,
|
|
125
|
-
amount: 100n,
|
|
126
133
|
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
127
134
|
}
|
|
128
135
|
|
|
@@ -149,14 +156,15 @@ test('can create a two-phase transfer', async (): Promise<void> => {
|
|
|
149
156
|
id: 2n,
|
|
150
157
|
debit_account_id: accountB.id,
|
|
151
158
|
credit_account_id: accountA.id,
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
amount: 50n,
|
|
160
|
+
user_data_128: 0n,
|
|
161
|
+
user_data_64: 0n,
|
|
162
|
+
user_data_32: 0,
|
|
154
163
|
pending_id: 0n,
|
|
155
|
-
timeout:
|
|
164
|
+
timeout: 2e9,
|
|
156
165
|
ledger: 1,
|
|
157
166
|
code: 1,
|
|
158
167
|
flags,
|
|
159
|
-
amount: 50n,
|
|
160
168
|
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
161
169
|
}
|
|
162
170
|
|
|
@@ -181,12 +189,13 @@ test('can create a two-phase transfer', async (): Promise<void> => {
|
|
|
181
189
|
assert.strictEqual(transfers[0].id, 2n)
|
|
182
190
|
assert.strictEqual(transfers[0].debit_account_id, accountB.id)
|
|
183
191
|
assert.strictEqual(transfers[0].credit_account_id, accountA.id)
|
|
184
|
-
assert.strictEqual(transfers[0].
|
|
185
|
-
assert.
|
|
192
|
+
assert.strictEqual(transfers[0].amount, 50n)
|
|
193
|
+
assert.strictEqual(transfers[0].user_data_128, 0n)
|
|
194
|
+
assert.strictEqual(transfers[0].user_data_64, 0n)
|
|
195
|
+
assert.strictEqual(transfers[0].user_data_32, 0)
|
|
186
196
|
assert.strictEqual(transfers[0].timeout > 0, true)
|
|
187
197
|
assert.strictEqual(transfers[0].code, 1)
|
|
188
198
|
assert.strictEqual(transfers[0].flags, 2)
|
|
189
|
-
assert.strictEqual(transfers[0].amount, 50n)
|
|
190
199
|
assert.strictEqual(transfers[0].timestamp > 0, true)
|
|
191
200
|
})
|
|
192
201
|
|
|
@@ -198,14 +207,15 @@ test('can post a two-phase transfer', async (): Promise<void> => {
|
|
|
198
207
|
id: 3n,
|
|
199
208
|
debit_account_id: BigInt(0),
|
|
200
209
|
credit_account_id: BigInt(0),
|
|
201
|
-
|
|
202
|
-
|
|
210
|
+
amount: 0n,
|
|
211
|
+
user_data_128: 0n,
|
|
212
|
+
user_data_64: 0n,
|
|
213
|
+
user_data_32: 0,
|
|
203
214
|
pending_id: 2n,// must match the id of the pending transfer
|
|
204
|
-
timeout:
|
|
215
|
+
timeout: 0,
|
|
205
216
|
ledger: 1,
|
|
206
217
|
code: 1,
|
|
207
218
|
flags: flags,
|
|
208
|
-
amount: 0n,
|
|
209
219
|
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
210
220
|
}
|
|
211
221
|
|
|
@@ -231,14 +241,15 @@ test('can reject a two-phase transfer', async (): Promise<void> => {
|
|
|
231
241
|
id: 4n,
|
|
232
242
|
debit_account_id: accountB.id,
|
|
233
243
|
credit_account_id: accountA.id,
|
|
234
|
-
|
|
235
|
-
|
|
244
|
+
amount: 50n,
|
|
245
|
+
user_data_128: 0n,
|
|
246
|
+
user_data_64: 0n,
|
|
247
|
+
user_data_32: 0,
|
|
236
248
|
pending_id: 0n,
|
|
237
|
-
timeout:
|
|
249
|
+
timeout: 1e9,
|
|
238
250
|
ledger: 1,
|
|
239
251
|
code: 1,
|
|
240
252
|
flags: TransferFlags.pending,
|
|
241
|
-
amount: 50n,
|
|
242
253
|
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
243
254
|
}
|
|
244
255
|
const transferErrors = await client.createTransfers([transfer])
|
|
@@ -249,14 +260,15 @@ test('can reject a two-phase transfer', async (): Promise<void> => {
|
|
|
249
260
|
id: 5n,
|
|
250
261
|
debit_account_id: BigInt(0),
|
|
251
262
|
credit_account_id: BigInt(0),
|
|
252
|
-
|
|
253
|
-
|
|
263
|
+
amount: 0n,
|
|
264
|
+
user_data_128: 0n,
|
|
265
|
+
user_data_64: 0n,
|
|
266
|
+
user_data_32: 0,
|
|
254
267
|
pending_id: 4n, // must match the id of the pending transfer
|
|
255
|
-
timeout:
|
|
268
|
+
timeout: 0,
|
|
256
269
|
ledger: 1,
|
|
257
270
|
code: 1,
|
|
258
271
|
flags: TransferFlags.void_pending_transfer,
|
|
259
|
-
amount: 0n,
|
|
260
272
|
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
261
273
|
}
|
|
262
274
|
|
|
@@ -281,30 +293,32 @@ test('can link transfers', async (): Promise<void> => {
|
|
|
281
293
|
id: 6n,
|
|
282
294
|
debit_account_id: accountB.id,
|
|
283
295
|
credit_account_id: accountA.id,
|
|
284
|
-
|
|
285
|
-
|
|
296
|
+
amount: 100n,
|
|
297
|
+
user_data_128: 0n,
|
|
298
|
+
user_data_64: 0n,
|
|
299
|
+
user_data_32: 0,
|
|
286
300
|
pending_id: 0n,
|
|
287
|
-
timeout:
|
|
301
|
+
timeout: 0,
|
|
288
302
|
ledger: 1,
|
|
289
303
|
code: 1,
|
|
290
304
|
flags: TransferFlags.linked, // points to transfer2
|
|
291
|
-
amount: 100n,
|
|
292
305
|
timestamp: 0n, // will be set correctly by the TigerBeetle server
|
|
293
306
|
}
|
|
294
307
|
const transfer2: Transfer = {
|
|
295
308
|
id: 6n,
|
|
296
309
|
debit_account_id: accountB.id,
|
|
297
310
|
credit_account_id: accountA.id,
|
|
298
|
-
|
|
299
|
-
|
|
311
|
+
amount: 100n,
|
|
312
|
+
user_data_128: 0n,
|
|
313
|
+
user_data_64: 0n,
|
|
314
|
+
user_data_32: 0,
|
|
300
315
|
pending_id: 0n,
|
|
301
|
-
timeout:
|
|
316
|
+
timeout: 0,
|
|
302
317
|
ledger: 1,
|
|
303
318
|
code: 1,
|
|
304
319
|
// Does not have linked flag as it is the end of the chain.
|
|
305
320
|
// This will also cause it to fail as this is now a duplicate with different flags
|
|
306
321
|
flags: 0,
|
|
307
|
-
amount: 100n,
|
|
308
322
|
timestamp: 0n, // will be set correctly by the TigerBeetle server
|
|
309
323
|
}
|
|
310
324
|
|