fatoority 0.4.3 → 0.5.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.
@@ -37,6 +37,71 @@ export class OriginalInvoiceRef {
37
37
  }
38
38
 
39
39
 
40
+ static new_(id, uuid, date, time, typeCode) {
41
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
42
+
43
+ const idSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, id)));
44
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
45
+
46
+
47
+ const result = wasm.fatoora_OriginalInvoiceRef_new(diplomatReceive.buffer, idSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, uuid, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, date, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, time, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, typeCode, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
48
+
49
+ try {
50
+ if (!diplomatReceive.resultFlag) {
51
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
52
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
53
+ }
54
+ return new OriginalInvoiceRef(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ functionCleanupArena.free();
60
+
61
+ diplomatReceive.free();
62
+ }
63
+ }
64
+
65
+ issueTime() {
66
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
67
+
68
+
69
+ const result = wasm.fatoora_OriginalInvoiceRef_issue_time(diplomatReceive.buffer, this.ffiValue);
70
+
71
+ try {
72
+ if (!diplomatReceive.resultFlag) {
73
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
74
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
75
+ }
76
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
77
+ }
78
+
79
+ finally {
80
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
81
+ diplomatReceive.free();
82
+ }
83
+ }
84
+
85
+ documentTypeCode() {
86
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
87
+
88
+
89
+ const result = wasm.fatoora_OriginalInvoiceRef_document_type_code(diplomatReceive.buffer, this.ffiValue);
90
+
91
+ try {
92
+ if (!diplomatReceive.resultFlag) {
93
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
94
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
95
+ }
96
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
97
+ }
98
+
99
+ finally {
100
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
101
+ diplomatReceive.free();
102
+ }
103
+ }
104
+
40
105
  id() {
41
106
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
42
107
 
@@ -14,7 +14,11 @@ export class Party {
14
14
  constructor();
15
15
 
16
16
 
17
- address(): Address;
17
+ identifiersLen(): number;
18
+
19
+ identifier(index: number): OtherId;
20
+
21
+ address(): Address | null;
18
22
 
19
23
  vatId(): VatId | null;
20
24
 
@@ -39,6 +39,39 @@ export class Party {
39
39
  }
40
40
 
41
41
 
42
+ identifiersLen() {
43
+
44
+ const result = wasm.fatoora_Party_identifiers_len(this.ffiValue);
45
+
46
+ try {
47
+ return result;
48
+ }
49
+
50
+ finally {
51
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
52
+ }
53
+ }
54
+
55
+ identifier(index) {
56
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
57
+
58
+
59
+ const result = wasm.fatoora_Party_identifier(diplomatReceive.buffer, this.ffiValue, index);
60
+
61
+ try {
62
+ if (!diplomatReceive.resultFlag) {
63
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
64
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
65
+ }
66
+ return new OtherId(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
67
+ }
68
+
69
+ finally {
70
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
71
+ diplomatReceive.free();
72
+ }
73
+ }
74
+
42
75
  address() {
43
76
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
44
77
 
@@ -50,7 +83,7 @@ export class Party {
50
83
  const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
51
84
  throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
52
85
  }
53
- return new Address(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
86
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Address(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
54
87
  }
55
88
 
56
89
  finally {
@@ -0,0 +1,34 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { Text } from "./Text.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ export class PaymentMeans {
9
+ /** @internal */
10
+ get ffiValue(): pointer;
11
+ /** @internal */
12
+ constructor();
13
+
14
+
15
+ withInstructionNote(value: string): PaymentMeans;
16
+
17
+ instructionNotesLen(): number;
18
+
19
+ instructionNoteAt(index: number): Text;
20
+
21
+ static new_(code: string, instruction: string | null): PaymentMeans;
22
+
23
+ withAccount(id: string | null, terms: string | null): PaymentMeans;
24
+
25
+ code(): string;
26
+
27
+ instructionNote(): Text | null;
28
+
29
+ hasAccount(): boolean;
30
+
31
+ accountIdentifier(): Text | null;
32
+
33
+ paymentTerms(): Text | null;
34
+ }
@@ -0,0 +1,246 @@
1
+ // generated by diplomat-tool
2
+ import { BindingError } from "./BindingError.mjs"
3
+ import { Text } from "./Text.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const PaymentMeans_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.fatoora_PaymentMeans_destroy(ptr);
9
+ });
10
+
11
+ export class PaymentMeans {
12
+ // Internal ptr reference:
13
+ #ptr = null;
14
+
15
+ // Lifetimes are only to keep dependencies alive.
16
+ // Since JS won't garbage collect until there are no incoming edges.
17
+ #selfEdge = [];
18
+
19
+ #internalConstructor(symbol, ptr, selfEdge) {
20
+ if (symbol !== diplomatRuntime.internalConstructor) {
21
+ console.error("PaymentMeans is an Opaque type. You cannot call its constructor.");
22
+ return;
23
+ }
24
+ this.#ptr = ptr;
25
+ this.#selfEdge = selfEdge;
26
+
27
+ // Are we being borrowed? If not, we can register.
28
+ if (this.#selfEdge.length === 0) {
29
+ PaymentMeans_box_destroy_registry.register(this, this.#ptr);
30
+ }
31
+
32
+ return this;
33
+ }
34
+ /** @internal */
35
+ get ffiValue() {
36
+ return this.#ptr;
37
+ }
38
+
39
+
40
+ withInstructionNote(value) {
41
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
42
+
43
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
44
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
45
+
46
+
47
+ const result = wasm.fatoora_PaymentMeans_with_instruction_note(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
48
+
49
+ try {
50
+ if (!diplomatReceive.resultFlag) {
51
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
52
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
53
+ }
54
+ return new PaymentMeans(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ functionCleanupArena.free();
60
+
61
+ diplomatReceive.free();
62
+ }
63
+ }
64
+
65
+ instructionNotesLen() {
66
+
67
+ const result = wasm.fatoora_PaymentMeans_instruction_notes_len(this.ffiValue);
68
+
69
+ try {
70
+ return result;
71
+ }
72
+
73
+ finally {
74
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
75
+ }
76
+ }
77
+
78
+ instructionNoteAt(index) {
79
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
80
+
81
+
82
+ const result = wasm.fatoora_PaymentMeans_instruction_note_at(diplomatReceive.buffer, this.ffiValue, index);
83
+
84
+ try {
85
+ if (!diplomatReceive.resultFlag) {
86
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
87
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
88
+ }
89
+ return new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
90
+ }
91
+
92
+ finally {
93
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
94
+ diplomatReceive.free();
95
+ }
96
+ }
97
+
98
+ static new_(code, instruction) {
99
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
100
+
101
+ const codeSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, code)));
102
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
103
+
104
+
105
+ const result = wasm.fatoora_PaymentMeans_new(diplomatReceive.buffer, codeSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, instruction, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
106
+
107
+ try {
108
+ if (!diplomatReceive.resultFlag) {
109
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
110
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
111
+ }
112
+ return new PaymentMeans(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
113
+ }
114
+
115
+ finally {
116
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
117
+ functionCleanupArena.free();
118
+
119
+ diplomatReceive.free();
120
+ }
121
+ }
122
+
123
+ withAccount(id, terms) {
124
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
125
+
126
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
127
+
128
+
129
+ const result = wasm.fatoora_PaymentMeans_with_account(diplomatReceive.buffer, this.ffiValue, diplomatRuntime.optionToBufferForCalling(wasm, id, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, terms, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
130
+
131
+ try {
132
+ if (!diplomatReceive.resultFlag) {
133
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
134
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
135
+ }
136
+ return new PaymentMeans(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
137
+ }
138
+
139
+ finally {
140
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
141
+ functionCleanupArena.free();
142
+
143
+ diplomatReceive.free();
144
+ }
145
+ }
146
+
147
+ code() {
148
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
149
+
150
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
151
+
152
+
153
+ const result = wasm.fatoora_PaymentMeans_code(diplomatReceive.buffer, this.ffiValue, write.buffer);
154
+
155
+ try {
156
+ if (!diplomatReceive.resultFlag) {
157
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
158
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
159
+ }
160
+ return write.readString8();
161
+ }
162
+
163
+ finally {
164
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
165
+ diplomatReceive.free();
166
+ write.free();
167
+ }
168
+ }
169
+
170
+ instructionNote() {
171
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
172
+
173
+
174
+ const result = wasm.fatoora_PaymentMeans_instruction_note(diplomatReceive.buffer, this.ffiValue);
175
+
176
+ try {
177
+ if (!diplomatReceive.resultFlag) {
178
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
179
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
180
+ }
181
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
182
+ }
183
+
184
+ finally {
185
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
186
+ diplomatReceive.free();
187
+ }
188
+ }
189
+
190
+ hasAccount() {
191
+
192
+ const result = wasm.fatoora_PaymentMeans_has_account(this.ffiValue);
193
+
194
+ try {
195
+ return result;
196
+ }
197
+
198
+ finally {
199
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
200
+ }
201
+ }
202
+
203
+ accountIdentifier() {
204
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
205
+
206
+
207
+ const result = wasm.fatoora_PaymentMeans_account_identifier(diplomatReceive.buffer, this.ffiValue);
208
+
209
+ try {
210
+ if (!diplomatReceive.resultFlag) {
211
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
212
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
213
+ }
214
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
215
+ }
216
+
217
+ finally {
218
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
219
+ diplomatReceive.free();
220
+ }
221
+ }
222
+
223
+ paymentTerms() {
224
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
225
+
226
+
227
+ const result = wasm.fatoora_PaymentMeans_payment_terms(diplomatReceive.buffer, this.ffiValue);
228
+
229
+ try {
230
+ if (!diplomatReceive.resultFlag) {
231
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
232
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
233
+ }
234
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
235
+ }
236
+
237
+ finally {
238
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
239
+ diplomatReceive.free();
240
+ }
241
+ }
242
+
243
+ constructor(symbol, ptr, selfEdge) {
244
+ return this.#internalConstructor(...arguments)
245
+ }
246
+ }
@@ -0,0 +1,20 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { Text } from "./Text.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ export class TaxExemption {
9
+ /** @internal */
10
+ get ffiValue(): pointer;
11
+ /** @internal */
12
+ constructor();
13
+
14
+
15
+ static new_(code: string | null, reason: string | null): TaxExemption;
16
+
17
+ reasonCode(): Text | null;
18
+
19
+ reason(): Text | null;
20
+ }
@@ -0,0 +1,107 @@
1
+ // generated by diplomat-tool
2
+ import { BindingError } from "./BindingError.mjs"
3
+ import { Text } from "./Text.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const TaxExemption_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.fatoora_TaxExemption_destroy(ptr);
9
+ });
10
+
11
+ export class TaxExemption {
12
+ // Internal ptr reference:
13
+ #ptr = null;
14
+
15
+ // Lifetimes are only to keep dependencies alive.
16
+ // Since JS won't garbage collect until there are no incoming edges.
17
+ #selfEdge = [];
18
+
19
+ #internalConstructor(symbol, ptr, selfEdge) {
20
+ if (symbol !== diplomatRuntime.internalConstructor) {
21
+ console.error("TaxExemption is an Opaque type. You cannot call its constructor.");
22
+ return;
23
+ }
24
+ this.#ptr = ptr;
25
+ this.#selfEdge = selfEdge;
26
+
27
+ // Are we being borrowed? If not, we can register.
28
+ if (this.#selfEdge.length === 0) {
29
+ TaxExemption_box_destroy_registry.register(this, this.#ptr);
30
+ }
31
+
32
+ return this;
33
+ }
34
+ /** @internal */
35
+ get ffiValue() {
36
+ return this.#ptr;
37
+ }
38
+
39
+
40
+ static new_(code, reason) {
41
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
42
+
43
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
44
+
45
+
46
+ const result = wasm.fatoora_TaxExemption_new(diplomatReceive.buffer, diplomatRuntime.optionToBufferForCalling(wasm, code, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, reason, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
47
+
48
+ try {
49
+ if (!diplomatReceive.resultFlag) {
50
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
51
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
52
+ }
53
+ return new TaxExemption(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
54
+ }
55
+
56
+ finally {
57
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
58
+ functionCleanupArena.free();
59
+
60
+ diplomatReceive.free();
61
+ }
62
+ }
63
+
64
+ reasonCode() {
65
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
66
+
67
+
68
+ const result = wasm.fatoora_TaxExemption_reason_code(diplomatReceive.buffer, this.ffiValue);
69
+
70
+ try {
71
+ if (!diplomatReceive.resultFlag) {
72
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
73
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
74
+ }
75
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
76
+ }
77
+
78
+ finally {
79
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
80
+ diplomatReceive.free();
81
+ }
82
+ }
83
+
84
+ reason() {
85
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
86
+
87
+
88
+ const result = wasm.fatoora_TaxExemption_reason(diplomatReceive.buffer, this.ffiValue);
89
+
90
+ try {
91
+ if (!diplomatReceive.resultFlag) {
92
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
93
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
94
+ }
95
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
96
+ }
97
+
98
+ finally {
99
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
100
+ diplomatReceive.free();
101
+ }
102
+ }
103
+
104
+ constructor(symbol, ptr, selfEdge) {
105
+ return this.#internalConstructor(...arguments)
106
+ }
107
+ }
@@ -0,0 +1,30 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { TaxExemption } from "./TaxExemption.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ export class VatBreakdown {
9
+ /** @internal */
10
+ get ffiValue(): pointer;
11
+ /** @internal */
12
+ constructor();
13
+
14
+
15
+ hasVatRate(): boolean;
16
+
17
+ withoutVatRate(): VatBreakdown;
18
+
19
+ static new_(category: number, rate: string, taxableAmount: string, taxAmount: string, exemption: TaxExemption): VatBreakdown;
20
+
21
+ category(): number;
22
+
23
+ rate(): string;
24
+
25
+ taxableAmount(): string;
26
+
27
+ taxAmount(): string;
28
+
29
+ exemption(): TaxExemption;
30
+ }