@buildonspark/issuer-sdk 0.0.30 → 0.0.31
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/index.cjs +31 -39
- package/dist/index.d.cts +17 -9
- package/dist/index.d.ts +17 -9
- package/dist/index.js +31 -39
- package/package.json +3 -2
- package/src/index.ts +1 -1
- package/src/issuer-spark-wallet.ts +39 -28
- package/src/proto/common.ts +91 -38
- package/src/proto/google/protobuf/descriptor.ts +2308 -1439
- package/src/proto/google/protobuf/duration.ts +28 -10
- package/src/proto/google/protobuf/empty.ts +24 -10
- package/src/proto/google/protobuf/timestamp.ts +28 -10
- package/src/proto/mock.ts +84 -54
- package/src/proto/spark.ts +9718 -7485
- package/src/proto/spark_authn.ts +165 -60
- package/src/proto/validate/validate.ts +1157 -661
- package/src/services/token-transactions.ts +2 -2
- package/src/tests/integration/spark.test.ts +11 -82
- package/src/tests/stress/transfers.test.ts +101 -10
- package/src/types.ts +73 -70
- package/src/utils/enum-mappers.ts +16 -5
- package/src/utils/token-hashing.ts +2 -2
- package/src/utils/type-mappers.ts +136 -103
|
@@ -92,7 +92,10 @@ function createBaseDuration(): Duration {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export const Duration: MessageFns<Duration> = {
|
|
95
|
-
encode(
|
|
95
|
+
encode(
|
|
96
|
+
message: Duration,
|
|
97
|
+
writer: BinaryWriter = new BinaryWriter(),
|
|
98
|
+
): BinaryWriter {
|
|
96
99
|
if (message.seconds !== 0) {
|
|
97
100
|
writer.uint32(8).int64(message.seconds);
|
|
98
101
|
}
|
|
@@ -103,7 +106,8 @@ export const Duration: MessageFns<Duration> = {
|
|
|
103
106
|
},
|
|
104
107
|
|
|
105
108
|
decode(input: BinaryReader | Uint8Array, length?: number): Duration {
|
|
106
|
-
const reader =
|
|
109
|
+
const reader =
|
|
110
|
+
input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
107
111
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
108
112
|
const message = createBaseDuration();
|
|
109
113
|
while (reader.pos < end) {
|
|
@@ -163,14 +167,28 @@ export const Duration: MessageFns<Duration> = {
|
|
|
163
167
|
},
|
|
164
168
|
};
|
|
165
169
|
|
|
166
|
-
type Builtin =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
type Builtin =
|
|
171
|
+
| Date
|
|
172
|
+
| Function
|
|
173
|
+
| Uint8Array
|
|
174
|
+
| string
|
|
175
|
+
| number
|
|
176
|
+
| boolean
|
|
177
|
+
| undefined;
|
|
178
|
+
|
|
179
|
+
export type DeepPartial<T> = T extends Builtin
|
|
180
|
+
? T
|
|
181
|
+
: T extends globalThis.Array<infer U>
|
|
182
|
+
? globalThis.Array<DeepPartial<U>>
|
|
183
|
+
: T extends ReadonlyArray<infer U>
|
|
184
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
185
|
+
: T extends { $case: string }
|
|
186
|
+
? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & {
|
|
187
|
+
$case: T["$case"];
|
|
188
|
+
}
|
|
189
|
+
: T extends {}
|
|
190
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
191
|
+
: Partial<T>;
|
|
174
192
|
|
|
175
193
|
function longToNumber(int64: { toString(): string }): number {
|
|
176
194
|
const num = globalThis.Number(int64.toString());
|
|
@@ -18,8 +18,7 @@ export const protobufPackage = "google.protobuf";
|
|
|
18
18
|
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
19
19
|
* }
|
|
20
20
|
*/
|
|
21
|
-
export interface Empty {
|
|
22
|
-
}
|
|
21
|
+
export interface Empty {}
|
|
23
22
|
|
|
24
23
|
function createBaseEmpty(): Empty {
|
|
25
24
|
return {};
|
|
@@ -31,7 +30,8 @@ export const Empty: MessageFns<Empty> = {
|
|
|
31
30
|
},
|
|
32
31
|
|
|
33
32
|
decode(input: BinaryReader | Uint8Array, length?: number): Empty {
|
|
34
|
-
const reader =
|
|
33
|
+
const reader =
|
|
34
|
+
input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35
35
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
36
36
|
const message = createBaseEmpty();
|
|
37
37
|
while (reader.pos < end) {
|
|
@@ -64,14 +64,28 @@ export const Empty: MessageFns<Empty> = {
|
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
type Builtin =
|
|
67
|
+
type Builtin =
|
|
68
|
+
| Date
|
|
69
|
+
| Function
|
|
70
|
+
| Uint8Array
|
|
71
|
+
| string
|
|
72
|
+
| number
|
|
73
|
+
| boolean
|
|
74
|
+
| undefined;
|
|
68
75
|
|
|
69
|
-
export type DeepPartial<T> = T extends Builtin
|
|
70
|
-
|
|
71
|
-
: T extends
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
export type DeepPartial<T> = T extends Builtin
|
|
77
|
+
? T
|
|
78
|
+
: T extends globalThis.Array<infer U>
|
|
79
|
+
? globalThis.Array<DeepPartial<U>>
|
|
80
|
+
: T extends ReadonlyArray<infer U>
|
|
81
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
82
|
+
: T extends { $case: string }
|
|
83
|
+
? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & {
|
|
84
|
+
$case: T["$case"];
|
|
85
|
+
}
|
|
86
|
+
: T extends {}
|
|
87
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
88
|
+
: Partial<T>;
|
|
75
89
|
|
|
76
90
|
export interface MessageFns<T> {
|
|
77
91
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
@@ -121,7 +121,10 @@ function createBaseTimestamp(): Timestamp {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
export const Timestamp: MessageFns<Timestamp> = {
|
|
124
|
-
encode(
|
|
124
|
+
encode(
|
|
125
|
+
message: Timestamp,
|
|
126
|
+
writer: BinaryWriter = new BinaryWriter(),
|
|
127
|
+
): BinaryWriter {
|
|
125
128
|
if (message.seconds !== 0) {
|
|
126
129
|
writer.uint32(8).int64(message.seconds);
|
|
127
130
|
}
|
|
@@ -132,7 +135,8 @@ export const Timestamp: MessageFns<Timestamp> = {
|
|
|
132
135
|
},
|
|
133
136
|
|
|
134
137
|
decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
|
|
135
|
-
const reader =
|
|
138
|
+
const reader =
|
|
139
|
+
input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
136
140
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
137
141
|
const message = createBaseTimestamp();
|
|
138
142
|
while (reader.pos < end) {
|
|
@@ -192,14 +196,28 @@ export const Timestamp: MessageFns<Timestamp> = {
|
|
|
192
196
|
},
|
|
193
197
|
};
|
|
194
198
|
|
|
195
|
-
type Builtin =
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
type Builtin =
|
|
200
|
+
| Date
|
|
201
|
+
| Function
|
|
202
|
+
| Uint8Array
|
|
203
|
+
| string
|
|
204
|
+
| number
|
|
205
|
+
| boolean
|
|
206
|
+
| undefined;
|
|
207
|
+
|
|
208
|
+
export type DeepPartial<T> = T extends Builtin
|
|
209
|
+
? T
|
|
210
|
+
: T extends globalThis.Array<infer U>
|
|
211
|
+
? globalThis.Array<DeepPartial<U>>
|
|
212
|
+
: T extends ReadonlyArray<infer U>
|
|
213
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
214
|
+
: T extends { $case: string }
|
|
215
|
+
? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & {
|
|
216
|
+
$case: T["$case"];
|
|
217
|
+
}
|
|
218
|
+
: T extends {}
|
|
219
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
220
|
+
: Partial<T>;
|
|
203
221
|
|
|
204
222
|
function longToNumber(int64: { toString(): string }): number {
|
|
205
223
|
const num = globalThis.Number(int64.toString());
|
package/src/proto/mock.ts
CHANGED
|
@@ -19,59 +19,75 @@ function createBaseCleanUpPreimageShareRequest(): CleanUpPreimageShareRequest {
|
|
|
19
19
|
return { paymentHash: new Uint8Array(0) };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const CleanUpPreimageShareRequest: MessageFns<CleanUpPreimageShareRequest> =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export const CleanUpPreimageShareRequest: MessageFns<CleanUpPreimageShareRequest> =
|
|
23
|
+
{
|
|
24
|
+
encode(
|
|
25
|
+
message: CleanUpPreimageShareRequest,
|
|
26
|
+
writer: BinaryWriter = new BinaryWriter(),
|
|
27
|
+
): BinaryWriter {
|
|
28
|
+
if (message.paymentHash.length !== 0) {
|
|
29
|
+
writer.uint32(10).bytes(message.paymentHash);
|
|
30
|
+
}
|
|
31
|
+
return writer;
|
|
32
|
+
},
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
decode(
|
|
35
|
+
input: BinaryReader | Uint8Array,
|
|
36
|
+
length?: number,
|
|
37
|
+
): CleanUpPreimageShareRequest {
|
|
38
|
+
const reader =
|
|
39
|
+
input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
40
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
41
|
+
const message = createBaseCleanUpPreimageShareRequest();
|
|
42
|
+
while (reader.pos < end) {
|
|
43
|
+
const tag = reader.uint32();
|
|
44
|
+
switch (tag >>> 3) {
|
|
45
|
+
case 1: {
|
|
46
|
+
if (tag !== 10) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message.paymentHash = reader.bytes();
|
|
51
|
+
continue;
|
|
40
52
|
}
|
|
41
|
-
|
|
42
|
-
message.paymentHash = reader.bytes();
|
|
43
|
-
continue;
|
|
44
53
|
}
|
|
54
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
reader.skip(tag & 7);
|
|
45
58
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
reader.skip(tag & 7);
|
|
50
|
-
}
|
|
51
|
-
return message;
|
|
52
|
-
},
|
|
59
|
+
return message;
|
|
60
|
+
},
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
fromJSON(object: any): CleanUpPreimageShareRequest {
|
|
63
|
+
return {
|
|
64
|
+
paymentHash: isSet(object.paymentHash)
|
|
65
|
+
? bytesFromBase64(object.paymentHash)
|
|
66
|
+
: new Uint8Array(0),
|
|
67
|
+
};
|
|
68
|
+
},
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
toJSON(message: CleanUpPreimageShareRequest): unknown {
|
|
71
|
+
const obj: any = {};
|
|
72
|
+
if (message.paymentHash.length !== 0) {
|
|
73
|
+
obj.paymentHash = base64FromBytes(message.paymentHash);
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
},
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
create(
|
|
79
|
+
base?: DeepPartial<CleanUpPreimageShareRequest>,
|
|
80
|
+
): CleanUpPreimageShareRequest {
|
|
81
|
+
return CleanUpPreimageShareRequest.fromPartial(base ?? {});
|
|
82
|
+
},
|
|
83
|
+
fromPartial(
|
|
84
|
+
object: DeepPartial<CleanUpPreimageShareRequest>,
|
|
85
|
+
): CleanUpPreimageShareRequest {
|
|
86
|
+
const message = createBaseCleanUpPreimageShareRequest();
|
|
87
|
+
message.paymentHash = object.paymentHash ?? new Uint8Array(0);
|
|
88
|
+
return message;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
75
91
|
|
|
76
92
|
export type MockServiceDefinition = typeof MockServiceDefinition;
|
|
77
93
|
export const MockServiceDefinition = {
|
|
@@ -128,14 +144,28 @@ function base64FromBytes(arr: Uint8Array): string {
|
|
|
128
144
|
}
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
type Builtin =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
type Builtin =
|
|
148
|
+
| Date
|
|
149
|
+
| Function
|
|
150
|
+
| Uint8Array
|
|
151
|
+
| string
|
|
152
|
+
| number
|
|
153
|
+
| boolean
|
|
154
|
+
| undefined;
|
|
155
|
+
|
|
156
|
+
export type DeepPartial<T> = T extends Builtin
|
|
157
|
+
? T
|
|
158
|
+
: T extends globalThis.Array<infer U>
|
|
159
|
+
? globalThis.Array<DeepPartial<U>>
|
|
160
|
+
: T extends ReadonlyArray<infer U>
|
|
161
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
162
|
+
: T extends { $case: string }
|
|
163
|
+
? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & {
|
|
164
|
+
$case: T["$case"];
|
|
165
|
+
}
|
|
166
|
+
: T extends {}
|
|
167
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
168
|
+
: Partial<T>;
|
|
139
169
|
|
|
140
170
|
function isSet(value: any): boolean {
|
|
141
171
|
return value !== null && value !== undefined;
|