@openora/core 0.4.1-canary.12 → 0.4.1-canary.13
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/.tsbuildinfo +1 -1
- package/dist/contracts/adapters/index.d.ts +2 -2
- package/dist/contracts/adapters/index.d.ts.map +1 -1
- package/dist/contracts/adapters/index.js +1 -1
- package/dist/contracts/adapters/index.js.map +1 -1
- package/dist/contracts/adapters/payment.d.ts +57 -0
- package/dist/contracts/adapters/payment.d.ts.map +1 -1
- package/dist/contracts/adapters/payment.js +4 -2
- package/dist/contracts/adapters/payment.js.map +1 -1
- package/dist/contracts/schemas/__tests__/common-schemas.test.d.ts +2 -0
- package/dist/contracts/schemas/__tests__/common-schemas.test.d.ts.map +1 -0
- package/dist/contracts/schemas/__tests__/common-schemas.test.js +17 -0
- package/dist/contracts/schemas/__tests__/common-schemas.test.js.map +1 -0
- package/dist/contracts/schemas/common.js +1 -1
- package/dist/contracts/schemas/platform-config.d.ts +3 -0
- package/dist/contracts/schemas/platform-config.d.ts.map +1 -1
- package/dist/contracts/schemas/platform-config.js +2 -1
- package/dist/contracts/schemas/platform-config.js.map +1 -1
- package/dist/wallet/__tests__/hmac-payment-webhook-verifier.test.d.ts +2 -0
- package/dist/wallet/__tests__/hmac-payment-webhook-verifier.test.d.ts.map +1 -0
- package/dist/wallet/__tests__/hmac-payment-webhook-verifier.test.js +25 -0
- package/dist/wallet/__tests__/hmac-payment-webhook-verifier.test.js.map +1 -0
- package/dist/wallet/__tests__/wallet-auto-rule.router.test.js +8 -6
- package/dist/wallet/__tests__/wallet-auto-rule.router.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-auto-withdrawal.test.js +102 -4
- package/dist/wallet/__tests__/wallet-auto-withdrawal.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-webhook.router.test.d.ts +2 -0
- package/dist/wallet/__tests__/wallet-webhook.router.test.d.ts.map +1 -0
- package/dist/wallet/__tests__/wallet-webhook.router.test.js +78 -0
- package/dist/wallet/__tests__/wallet-webhook.router.test.js.map +1 -0
- package/dist/wallet/__tests__/wallet.router.test.js +4 -2
- package/dist/wallet/__tests__/wallet.router.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet.service.test.js +248 -3
- package/dist/wallet/__tests__/wallet.service.test.js.map +1 -1
- package/dist/wallet/adapters/hmac-payment-webhook-verifier.d.ts +7 -0
- package/dist/wallet/adapters/hmac-payment-webhook-verifier.d.ts.map +1 -0
- package/dist/wallet/adapters/hmac-payment-webhook-verifier.js +30 -0
- package/dist/wallet/adapters/hmac-payment-webhook-verifier.js.map +1 -0
- package/dist/wallet/contract/index.d.ts +28 -0
- package/dist/wallet/contract/index.d.ts.map +1 -1
- package/dist/wallet/contract/index.js +28 -7
- package/dist/wallet/contract/index.js.map +1 -1
- package/dist/wallet/drizzle/migrations/0002_aromatic_archangel.sql +20 -0
- package/dist/wallet/drizzle/migrations/meta/0002_snapshot.json +513 -0
- package/dist/wallet/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/wallet/plugin.d.ts.map +1 -1
- package/dist/wallet/plugin.js +12 -2
- package/dist/wallet/plugin.js.map +1 -1
- package/dist/wallet/router/index.d.ts +16 -2
- package/dist/wallet/router/index.d.ts.map +1 -1
- package/dist/wallet/router/index.js +24 -4
- package/dist/wallet/router/index.js.map +1 -1
- package/dist/wallet/schema/index.d.ts +144 -0
- package/dist/wallet/schema/index.d.ts.map +1 -1
- package/dist/wallet/schema/index.js +20 -4
- package/dist/wallet/schema/index.js.map +1 -1
- package/dist/wallet/service/wallet.service.d.ts +20 -2
- package/dist/wallet/service/wallet.service.d.ts.map +1 -1
- package/dist/wallet/service/wallet.service.js +196 -31
- package/dist/wallet/service/wallet.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "726e1ddb-ace9-4680-8f91-9708c79b80d5",
|
|
3
|
+
"prevId": "734cd227-e947-44f2-aae2-c47146fe2051",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.auto_withdrawal_rule": {
|
|
8
|
+
"name": "auto_withdrawal_rule",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uuid",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true,
|
|
16
|
+
"default": "gen_random_uuid()"
|
|
17
|
+
},
|
|
18
|
+
"user_id": {
|
|
19
|
+
"name": "user_id",
|
|
20
|
+
"type": "uuid",
|
|
21
|
+
"primaryKey": false,
|
|
22
|
+
"notNull": true
|
|
23
|
+
},
|
|
24
|
+
"threshold": {
|
|
25
|
+
"name": "threshold",
|
|
26
|
+
"type": "numeric(18, 8)",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true
|
|
29
|
+
},
|
|
30
|
+
"reason": {
|
|
31
|
+
"name": "reason",
|
|
32
|
+
"type": "text",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true
|
|
35
|
+
},
|
|
36
|
+
"created_by": {
|
|
37
|
+
"name": "created_by",
|
|
38
|
+
"type": "uuid",
|
|
39
|
+
"primaryKey": false,
|
|
40
|
+
"notNull": true
|
|
41
|
+
},
|
|
42
|
+
"created_at": {
|
|
43
|
+
"name": "created_at",
|
|
44
|
+
"type": "timestamp with time zone",
|
|
45
|
+
"primaryKey": false,
|
|
46
|
+
"notNull": true,
|
|
47
|
+
"default": "now()"
|
|
48
|
+
},
|
|
49
|
+
"updated_at": {
|
|
50
|
+
"name": "updated_at",
|
|
51
|
+
"type": "timestamp with time zone",
|
|
52
|
+
"primaryKey": false,
|
|
53
|
+
"notNull": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"indexes": {},
|
|
57
|
+
"foreignKeys": {},
|
|
58
|
+
"compositePrimaryKeys": {},
|
|
59
|
+
"uniqueConstraints": {
|
|
60
|
+
"auto_withdrawal_rule_user_id_unique": {
|
|
61
|
+
"name": "auto_withdrawal_rule_user_id_unique",
|
|
62
|
+
"nullsNotDistinct": false,
|
|
63
|
+
"columns": ["user_id"]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"policies": {},
|
|
67
|
+
"checkConstraints": {},
|
|
68
|
+
"isRLSEnabled": false
|
|
69
|
+
},
|
|
70
|
+
"public.wallet": {
|
|
71
|
+
"name": "wallet",
|
|
72
|
+
"schema": "",
|
|
73
|
+
"columns": {
|
|
74
|
+
"id": {
|
|
75
|
+
"name": "id",
|
|
76
|
+
"type": "uuid",
|
|
77
|
+
"primaryKey": true,
|
|
78
|
+
"notNull": true,
|
|
79
|
+
"default": "gen_random_uuid()"
|
|
80
|
+
},
|
|
81
|
+
"user_id": {
|
|
82
|
+
"name": "user_id",
|
|
83
|
+
"type": "uuid",
|
|
84
|
+
"primaryKey": false,
|
|
85
|
+
"notNull": true
|
|
86
|
+
},
|
|
87
|
+
"balance": {
|
|
88
|
+
"name": "balance",
|
|
89
|
+
"type": "numeric(18, 8)",
|
|
90
|
+
"primaryKey": false,
|
|
91
|
+
"notNull": true,
|
|
92
|
+
"default": "'0'"
|
|
93
|
+
},
|
|
94
|
+
"currency": {
|
|
95
|
+
"name": "currency",
|
|
96
|
+
"type": "text",
|
|
97
|
+
"primaryKey": false,
|
|
98
|
+
"notNull": true,
|
|
99
|
+
"default": "'USD'"
|
|
100
|
+
},
|
|
101
|
+
"updated_at": {
|
|
102
|
+
"name": "updated_at",
|
|
103
|
+
"type": "timestamp with time zone",
|
|
104
|
+
"primaryKey": false,
|
|
105
|
+
"notNull": true
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"indexes": {},
|
|
109
|
+
"foreignKeys": {},
|
|
110
|
+
"compositePrimaryKeys": {},
|
|
111
|
+
"uniqueConstraints": {
|
|
112
|
+
"wallet_user_id_unique": {
|
|
113
|
+
"name": "wallet_user_id_unique",
|
|
114
|
+
"nullsNotDistinct": false,
|
|
115
|
+
"columns": ["user_id"]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"policies": {},
|
|
119
|
+
"checkConstraints": {},
|
|
120
|
+
"isRLSEnabled": false
|
|
121
|
+
},
|
|
122
|
+
"public.wallet_deposit_address": {
|
|
123
|
+
"name": "wallet_deposit_address",
|
|
124
|
+
"schema": "",
|
|
125
|
+
"columns": {
|
|
126
|
+
"id": {
|
|
127
|
+
"name": "id",
|
|
128
|
+
"type": "uuid",
|
|
129
|
+
"primaryKey": true,
|
|
130
|
+
"notNull": true,
|
|
131
|
+
"default": "gen_random_uuid()"
|
|
132
|
+
},
|
|
133
|
+
"user_id": {
|
|
134
|
+
"name": "user_id",
|
|
135
|
+
"type": "uuid",
|
|
136
|
+
"primaryKey": false,
|
|
137
|
+
"notNull": true
|
|
138
|
+
},
|
|
139
|
+
"currency": {
|
|
140
|
+
"name": "currency",
|
|
141
|
+
"type": "text",
|
|
142
|
+
"primaryKey": false,
|
|
143
|
+
"notNull": true
|
|
144
|
+
},
|
|
145
|
+
"address": {
|
|
146
|
+
"name": "address",
|
|
147
|
+
"type": "text",
|
|
148
|
+
"primaryKey": false,
|
|
149
|
+
"notNull": true
|
|
150
|
+
},
|
|
151
|
+
"provider_name": {
|
|
152
|
+
"name": "provider_name",
|
|
153
|
+
"type": "text",
|
|
154
|
+
"primaryKey": false,
|
|
155
|
+
"notNull": true
|
|
156
|
+
},
|
|
157
|
+
"created_at": {
|
|
158
|
+
"name": "created_at",
|
|
159
|
+
"type": "timestamp with time zone",
|
|
160
|
+
"primaryKey": false,
|
|
161
|
+
"notNull": true,
|
|
162
|
+
"default": "now()"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"indexes": {
|
|
166
|
+
"wallet_deposit_address_user_id_currency_idx": {
|
|
167
|
+
"name": "wallet_deposit_address_user_id_currency_idx",
|
|
168
|
+
"columns": [
|
|
169
|
+
{
|
|
170
|
+
"expression": "user_id",
|
|
171
|
+
"isExpression": false,
|
|
172
|
+
"asc": true,
|
|
173
|
+
"nulls": "last"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"expression": "currency",
|
|
177
|
+
"isExpression": false,
|
|
178
|
+
"asc": true,
|
|
179
|
+
"nulls": "last"
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"isUnique": true,
|
|
183
|
+
"concurrently": false,
|
|
184
|
+
"method": "btree",
|
|
185
|
+
"with": {}
|
|
186
|
+
},
|
|
187
|
+
"wallet_deposit_address_address_idx": {
|
|
188
|
+
"name": "wallet_deposit_address_address_idx",
|
|
189
|
+
"columns": [
|
|
190
|
+
{
|
|
191
|
+
"expression": "address",
|
|
192
|
+
"isExpression": false,
|
|
193
|
+
"asc": true,
|
|
194
|
+
"nulls": "last"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"isUnique": false,
|
|
198
|
+
"concurrently": false,
|
|
199
|
+
"method": "btree",
|
|
200
|
+
"with": {}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"foreignKeys": {},
|
|
204
|
+
"compositePrimaryKeys": {},
|
|
205
|
+
"uniqueConstraints": {},
|
|
206
|
+
"policies": {},
|
|
207
|
+
"checkConstraints": {},
|
|
208
|
+
"isRLSEnabled": false
|
|
209
|
+
},
|
|
210
|
+
"public.wallet_transaction": {
|
|
211
|
+
"name": "wallet_transaction",
|
|
212
|
+
"schema": "",
|
|
213
|
+
"columns": {
|
|
214
|
+
"id": {
|
|
215
|
+
"name": "id",
|
|
216
|
+
"type": "uuid",
|
|
217
|
+
"primaryKey": true,
|
|
218
|
+
"notNull": true,
|
|
219
|
+
"default": "gen_random_uuid()"
|
|
220
|
+
},
|
|
221
|
+
"wallet_id": {
|
|
222
|
+
"name": "wallet_id",
|
|
223
|
+
"type": "uuid",
|
|
224
|
+
"primaryKey": false,
|
|
225
|
+
"notNull": true
|
|
226
|
+
},
|
|
227
|
+
"type": {
|
|
228
|
+
"name": "type",
|
|
229
|
+
"type": "wallet_transaction_type",
|
|
230
|
+
"typeSchema": "public",
|
|
231
|
+
"primaryKey": false,
|
|
232
|
+
"notNull": true
|
|
233
|
+
},
|
|
234
|
+
"amount": {
|
|
235
|
+
"name": "amount",
|
|
236
|
+
"type": "numeric(18, 8)",
|
|
237
|
+
"primaryKey": false,
|
|
238
|
+
"notNull": true
|
|
239
|
+
},
|
|
240
|
+
"currency": {
|
|
241
|
+
"name": "currency",
|
|
242
|
+
"type": "text",
|
|
243
|
+
"primaryKey": false,
|
|
244
|
+
"notNull": true
|
|
245
|
+
},
|
|
246
|
+
"status": {
|
|
247
|
+
"name": "status",
|
|
248
|
+
"type": "wallet_transaction_status",
|
|
249
|
+
"typeSchema": "public",
|
|
250
|
+
"primaryKey": false,
|
|
251
|
+
"notNull": true,
|
|
252
|
+
"default": "'pending'"
|
|
253
|
+
},
|
|
254
|
+
"rail": {
|
|
255
|
+
"name": "rail",
|
|
256
|
+
"type": "wallet_rail",
|
|
257
|
+
"typeSchema": "public",
|
|
258
|
+
"primaryKey": false,
|
|
259
|
+
"notNull": false
|
|
260
|
+
},
|
|
261
|
+
"reviewed_by": {
|
|
262
|
+
"name": "reviewed_by",
|
|
263
|
+
"type": "uuid",
|
|
264
|
+
"primaryKey": false,
|
|
265
|
+
"notNull": false
|
|
266
|
+
},
|
|
267
|
+
"reviewed_at": {
|
|
268
|
+
"name": "reviewed_at",
|
|
269
|
+
"type": "timestamp with time zone",
|
|
270
|
+
"primaryKey": false,
|
|
271
|
+
"notNull": false
|
|
272
|
+
},
|
|
273
|
+
"review_reason": {
|
|
274
|
+
"name": "review_reason",
|
|
275
|
+
"type": "text",
|
|
276
|
+
"primaryKey": false,
|
|
277
|
+
"notNull": false
|
|
278
|
+
},
|
|
279
|
+
"provider_name": {
|
|
280
|
+
"name": "provider_name",
|
|
281
|
+
"type": "text",
|
|
282
|
+
"primaryKey": false,
|
|
283
|
+
"notNull": false
|
|
284
|
+
},
|
|
285
|
+
"provider_ref_id": {
|
|
286
|
+
"name": "provider_ref_id",
|
|
287
|
+
"type": "text",
|
|
288
|
+
"primaryKey": false,
|
|
289
|
+
"notNull": false
|
|
290
|
+
},
|
|
291
|
+
"destination_address": {
|
|
292
|
+
"name": "destination_address",
|
|
293
|
+
"type": "text",
|
|
294
|
+
"primaryKey": false,
|
|
295
|
+
"notNull": false
|
|
296
|
+
},
|
|
297
|
+
"tx_hash": {
|
|
298
|
+
"name": "tx_hash",
|
|
299
|
+
"type": "text",
|
|
300
|
+
"primaryKey": false,
|
|
301
|
+
"notNull": false
|
|
302
|
+
},
|
|
303
|
+
"metadata": {
|
|
304
|
+
"name": "metadata",
|
|
305
|
+
"type": "text",
|
|
306
|
+
"primaryKey": false,
|
|
307
|
+
"notNull": false
|
|
308
|
+
},
|
|
309
|
+
"idempotency_key": {
|
|
310
|
+
"name": "idempotency_key",
|
|
311
|
+
"type": "uuid",
|
|
312
|
+
"primaryKey": false,
|
|
313
|
+
"notNull": false
|
|
314
|
+
},
|
|
315
|
+
"created_at": {
|
|
316
|
+
"name": "created_at",
|
|
317
|
+
"type": "timestamp with time zone",
|
|
318
|
+
"primaryKey": false,
|
|
319
|
+
"notNull": true,
|
|
320
|
+
"default": "now()"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"indexes": {
|
|
324
|
+
"wallet_transaction_wallet_id_idx": {
|
|
325
|
+
"name": "wallet_transaction_wallet_id_idx",
|
|
326
|
+
"columns": [
|
|
327
|
+
{
|
|
328
|
+
"expression": "wallet_id",
|
|
329
|
+
"isExpression": false,
|
|
330
|
+
"asc": true,
|
|
331
|
+
"nulls": "last"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"isUnique": false,
|
|
335
|
+
"concurrently": false,
|
|
336
|
+
"method": "btree",
|
|
337
|
+
"with": {}
|
|
338
|
+
},
|
|
339
|
+
"wallet_transaction_created_at_idx": {
|
|
340
|
+
"name": "wallet_transaction_created_at_idx",
|
|
341
|
+
"columns": [
|
|
342
|
+
{
|
|
343
|
+
"expression": "created_at",
|
|
344
|
+
"isExpression": false,
|
|
345
|
+
"asc": true,
|
|
346
|
+
"nulls": "last"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"isUnique": false,
|
|
350
|
+
"concurrently": false,
|
|
351
|
+
"method": "btree",
|
|
352
|
+
"with": {}
|
|
353
|
+
},
|
|
354
|
+
"wallet_transaction_type_idx": {
|
|
355
|
+
"name": "wallet_transaction_type_idx",
|
|
356
|
+
"columns": [
|
|
357
|
+
{
|
|
358
|
+
"expression": "type",
|
|
359
|
+
"isExpression": false,
|
|
360
|
+
"asc": true,
|
|
361
|
+
"nulls": "last"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"isUnique": false,
|
|
365
|
+
"concurrently": false,
|
|
366
|
+
"method": "btree",
|
|
367
|
+
"with": {}
|
|
368
|
+
},
|
|
369
|
+
"wallet_transaction_status_idx": {
|
|
370
|
+
"name": "wallet_transaction_status_idx",
|
|
371
|
+
"columns": [
|
|
372
|
+
{
|
|
373
|
+
"expression": "status",
|
|
374
|
+
"isExpression": false,
|
|
375
|
+
"asc": true,
|
|
376
|
+
"nulls": "last"
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
"isUnique": false,
|
|
380
|
+
"concurrently": false,
|
|
381
|
+
"method": "btree",
|
|
382
|
+
"with": {}
|
|
383
|
+
},
|
|
384
|
+
"wallet_transaction_rail_idx": {
|
|
385
|
+
"name": "wallet_transaction_rail_idx",
|
|
386
|
+
"columns": [
|
|
387
|
+
{
|
|
388
|
+
"expression": "rail",
|
|
389
|
+
"isExpression": false,
|
|
390
|
+
"asc": true,
|
|
391
|
+
"nulls": "last"
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
"isUnique": false,
|
|
395
|
+
"concurrently": false,
|
|
396
|
+
"method": "btree",
|
|
397
|
+
"with": {}
|
|
398
|
+
},
|
|
399
|
+
"wallet_transaction_currency_idx": {
|
|
400
|
+
"name": "wallet_transaction_currency_idx",
|
|
401
|
+
"columns": [
|
|
402
|
+
{
|
|
403
|
+
"expression": "currency",
|
|
404
|
+
"isExpression": false,
|
|
405
|
+
"asc": true,
|
|
406
|
+
"nulls": "last"
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"isUnique": false,
|
|
410
|
+
"concurrently": false,
|
|
411
|
+
"method": "btree",
|
|
412
|
+
"with": {}
|
|
413
|
+
},
|
|
414
|
+
"wallet_transaction_tx_hash_idx": {
|
|
415
|
+
"name": "wallet_transaction_tx_hash_idx",
|
|
416
|
+
"columns": [
|
|
417
|
+
{
|
|
418
|
+
"expression": "tx_hash",
|
|
419
|
+
"isExpression": false,
|
|
420
|
+
"asc": true,
|
|
421
|
+
"nulls": "last"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"isUnique": false,
|
|
425
|
+
"concurrently": false,
|
|
426
|
+
"method": "btree",
|
|
427
|
+
"with": {}
|
|
428
|
+
},
|
|
429
|
+
"wallet_transaction_provider_ref_id_idx": {
|
|
430
|
+
"name": "wallet_transaction_provider_ref_id_idx",
|
|
431
|
+
"columns": [
|
|
432
|
+
{
|
|
433
|
+
"expression": "provider_ref_id",
|
|
434
|
+
"isExpression": false,
|
|
435
|
+
"asc": true,
|
|
436
|
+
"nulls": "last"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"isUnique": true,
|
|
440
|
+
"where": "\"wallet_transaction\".\"provider_ref_id\" IS NOT NULL",
|
|
441
|
+
"concurrently": false,
|
|
442
|
+
"method": "btree",
|
|
443
|
+
"with": {}
|
|
444
|
+
},
|
|
445
|
+
"wallet_transaction_wallet_id_idempotency_key_idx": {
|
|
446
|
+
"name": "wallet_transaction_wallet_id_idempotency_key_idx",
|
|
447
|
+
"columns": [
|
|
448
|
+
{
|
|
449
|
+
"expression": "wallet_id",
|
|
450
|
+
"isExpression": false,
|
|
451
|
+
"asc": true,
|
|
452
|
+
"nulls": "last"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"expression": "idempotency_key",
|
|
456
|
+
"isExpression": false,
|
|
457
|
+
"asc": true,
|
|
458
|
+
"nulls": "last"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"isUnique": true,
|
|
462
|
+
"where": "\"wallet_transaction\".\"idempotency_key\" IS NOT NULL",
|
|
463
|
+
"concurrently": false,
|
|
464
|
+
"method": "btree",
|
|
465
|
+
"with": {}
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"foreignKeys": {
|
|
469
|
+
"wallet_transaction_wallet_id_wallet_id_fk": {
|
|
470
|
+
"name": "wallet_transaction_wallet_id_wallet_id_fk",
|
|
471
|
+
"tableFrom": "wallet_transaction",
|
|
472
|
+
"tableTo": "wallet",
|
|
473
|
+
"columnsFrom": ["wallet_id"],
|
|
474
|
+
"columnsTo": ["id"],
|
|
475
|
+
"onDelete": "no action",
|
|
476
|
+
"onUpdate": "no action"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
"compositePrimaryKeys": {},
|
|
480
|
+
"uniqueConstraints": {},
|
|
481
|
+
"policies": {},
|
|
482
|
+
"checkConstraints": {},
|
|
483
|
+
"isRLSEnabled": false
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
"enums": {
|
|
487
|
+
"public.wallet_rail": {
|
|
488
|
+
"name": "wallet_rail",
|
|
489
|
+
"schema": "public",
|
|
490
|
+
"values": ["crypto", "fiat"]
|
|
491
|
+
},
|
|
492
|
+
"public.wallet_transaction_status": {
|
|
493
|
+
"name": "wallet_transaction_status",
|
|
494
|
+
"schema": "public",
|
|
495
|
+
"values": ["pending", "processing", "completed", "failed", "rejected", "on_hold", "cancelled"]
|
|
496
|
+
},
|
|
497
|
+
"public.wallet_transaction_type": {
|
|
498
|
+
"name": "wallet_transaction_type",
|
|
499
|
+
"schema": "public",
|
|
500
|
+
"values": ["deposit", "withdrawal", "bet", "win", "loss", "bonus", "tip"]
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
"schemas": {},
|
|
504
|
+
"sequences": {},
|
|
505
|
+
"roles": {},
|
|
506
|
+
"policies": {},
|
|
507
|
+
"views": {},
|
|
508
|
+
"_meta": {
|
|
509
|
+
"columns": {},
|
|
510
|
+
"schemas": {},
|
|
511
|
+
"tables": {}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":";AAsBA,wBAyCG"}
|
package/dist/wallet/plugin.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { definePlugin, ADMIN_GUARD, EVENT_BUS, DRIZZLE } from '@openora/core/server';
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import { ADMIN_USER_DIRECTORY, ADMIN_WALLET_REPORTING, PAYMENT_ADAPTER, PAYMENT_WEBHOOK_VERIFIER, WALLET_COMMANDS, WALLET_READER, PLATFORM_CONFIG, RATE_LIMITER, PLAYER_TAGS, AUDIT_WRITER, } from '@openora/core/contracts';
|
|
3
4
|
import { WalletService } from './service/wallet.service.js';
|
|
4
5
|
import { WalletCommandsService } from './service/wallet-commands.service.js';
|
|
5
6
|
import { WalletReaderService } from './adapters/wallet-reader.service.js';
|
|
6
7
|
import { DrizzleAdminWalletReporting } from './admin-reporting.js';
|
|
7
8
|
import { createWalletRouter } from './router/index.js';
|
|
8
9
|
import { MockPaymentAdapter } from './adapters/mock/mock-payment-adapter.js';
|
|
10
|
+
import { HmacPaymentWebhookVerifier } from './adapters/hmac-payment-webhook-verifier.js';
|
|
9
11
|
export default definePlugin({
|
|
10
12
|
// NOT dependsOn 'tag': that would cycle (tag hard-depends on wallet's WALLET_READER).
|
|
11
13
|
// wallet's use of tag's PLAYER_TAGS is optional and resolved lazily in the router
|
|
@@ -15,6 +17,14 @@ export default definePlugin({
|
|
|
15
17
|
dependsOn: ['identity', 'audit'],
|
|
16
18
|
register(ctx) {
|
|
17
19
|
ctx.provide(PAYMENT_ADAPTER, () => new MockPaymentAdapter());
|
|
20
|
+
ctx.provide(PAYMENT_WEBHOOK_VERIFIER, () => {
|
|
21
|
+
const webhookSecret = z
|
|
22
|
+
.string()
|
|
23
|
+
.min(1)
|
|
24
|
+
.optional()
|
|
25
|
+
.parse(process.env.PAYMENT_WEBHOOK_SECRET || undefined);
|
|
26
|
+
return new HmacPaymentWebhookVerifier(webhookSecret);
|
|
27
|
+
});
|
|
18
28
|
// Other modules debit through this port within their own transaction (never importing wallet tables). See ADR-0016.
|
|
19
29
|
ctx.provide(WALLET_COMMANDS, () => new WalletCommandsService());
|
|
20
30
|
// Read-only queries for cross-module consumers (eg tag evaluation). Never exposes wallet internals.
|
|
@@ -29,7 +39,7 @@ export default definePlugin({
|
|
|
29
39
|
limiter: c.get(RATE_LIMITER),
|
|
30
40
|
riskTags: c.has(PLAYER_TAGS) ? c.get(PLAYER_TAGS) : undefined,
|
|
31
41
|
audit: c.get(AUDIT_WRITER),
|
|
32
|
-
}), c.get(ADMIN_GUARD), c.get(AUDIT_WRITER)));
|
|
42
|
+
}), c.get(ADMIN_GUARD), c.get(AUDIT_WRITER), c.get(PAYMENT_ADAPTER), c.get(PAYMENT_WEBHOOK_VERIFIER)));
|
|
33
43
|
},
|
|
34
44
|
});
|
|
35
45
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,aAAa,E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C;YACtC,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS;YAC3E,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7D,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;SAC3B,CAAC,EACF,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAClB,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EACnB,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,EACtB,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAChC,CACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AdminGuard, type OssContext } from '@openora/core/server';
|
|
2
|
-
import type { AuditWritePort } from '@openora/core/contracts';
|
|
2
|
+
import type { AuditWritePort, PaymentAdapter, PaymentWebhookVerifier } from '@openora/core/contracts';
|
|
3
3
|
import { WalletService } from '../service/wallet.service.js';
|
|
4
|
-
export declare function createWalletRouter(wallet: WalletService, adminGuard: AdminGuard, audit: AuditWritePort): {
|
|
4
|
+
export declare function createWalletRouter(wallet: WalletService, adminGuard: AdminGuard, audit: AuditWritePort, paymentAdapter: PaymentAdapter, webhookVerifier: PaymentWebhookVerifier): {
|
|
5
5
|
getBalance: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("@orpc/server").Schema<unknown, unknown>, import("zod").ZodObject<{
|
|
6
6
|
balance: import("zod").ZodString;
|
|
7
7
|
currency: import("zod").ZodString;
|
|
@@ -28,6 +28,7 @@ export declare function createWalletRouter(wallet: WalletService, adminGuard: Ad
|
|
|
28
28
|
currency: import("zod").ZodString;
|
|
29
29
|
provider: import("zod").ZodOptional<import("zod").ZodString>;
|
|
30
30
|
idempotencyKey: import("zod").ZodOptional<import("zod").ZodUUID>;
|
|
31
|
+
destinationAddress: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31
32
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
32
33
|
transactionId: import("zod").ZodUUID;
|
|
33
34
|
status: import("zod").ZodEnum<{
|
|
@@ -165,6 +166,8 @@ export declare function createWalletRouter(wallet: WalletService, adminGuard: Ad
|
|
|
165
166
|
}>>;
|
|
166
167
|
riskTags: import("zod").ZodArray<import("zod").ZodString>;
|
|
167
168
|
requestedAt: import("zod").ZodISODateTime;
|
|
169
|
+
destinationAddress: import("zod").ZodNullable<import("zod").ZodString>;
|
|
170
|
+
txHash: import("zod").ZodNullable<import("zod").ZodString>;
|
|
168
171
|
}, import("zod/v4/core").$strip>>;
|
|
169
172
|
total: import("zod").ZodNumber;
|
|
170
173
|
page: import("zod").ZodNumber;
|
|
@@ -229,5 +232,16 @@ export declare function createWalletRouter(wallet: WalletService, adminGuard: Ad
|
|
|
229
232
|
userId: import("zod").ZodUUID;
|
|
230
233
|
}, import("zod/v4/core").$strip>, import("zod").ZodBoolean, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
231
234
|
};
|
|
235
|
+
deposits: {
|
|
236
|
+
getAddress: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodObject<{
|
|
237
|
+
currency: import("zod").ZodString;
|
|
238
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
239
|
+
address: import("zod").ZodString;
|
|
240
|
+
currency: import("zod").ZodString;
|
|
241
|
+
}, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
242
|
+
};
|
|
243
|
+
webhook: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, import("zod").ZodObject<{
|
|
244
|
+
ok: import("zod").ZodLiteral<true>;
|
|
245
|
+
}, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
232
246
|
};
|
|
233
247
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallet/router/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallet/router/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,aAAa,EAUd,MAAM,8BAA8B,CAAC;AAEtC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,cAAc,EACrB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2IxC"}
|