@helium/blockchain-api 0.2.3 → 0.3.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.
- package/README.md +20 -74
- package/dist/index.d.ts +3940 -2763
- package/dist/index.js +523 -264
- package/package.json +4 -11
package/dist/index.js
CHANGED
|
@@ -1,69 +1,7 @@
|
|
|
1
|
-
import { createORPCClient } from '@orpc/client';
|
|
2
|
-
import { RPCLink } from '@orpc/client/fetch';
|
|
3
1
|
import { z } from 'zod';
|
|
4
2
|
import { oc } from '@orpc/contract';
|
|
5
3
|
|
|
6
|
-
// src/
|
|
7
|
-
function createClient(options) {
|
|
8
|
-
const { url, transport = "rpc" } = options;
|
|
9
|
-
const endpoint = transport === "rpc" ? `${url}/rpc` : `${url}/api/v1`;
|
|
10
|
-
const link = new RPCLink({
|
|
11
|
-
url: endpoint,
|
|
12
|
-
fetch: (input, init) => {
|
|
13
|
-
return fetch(input, {
|
|
14
|
-
...init,
|
|
15
|
-
credentials: "include"
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return createORPCClient(link);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// src/mock-client.ts
|
|
23
|
-
function createMockClient(mocks = {}) {
|
|
24
|
-
const createProxy = (path = []) => {
|
|
25
|
-
return new Proxy(() => {
|
|
26
|
-
}, {
|
|
27
|
-
get(_, prop) {
|
|
28
|
-
const newPath = [...path, prop];
|
|
29
|
-
let mockValue = mocks;
|
|
30
|
-
for (const key of newPath) {
|
|
31
|
-
if (mockValue && typeof mockValue === "object" && key in mockValue) {
|
|
32
|
-
mockValue = mockValue[key];
|
|
33
|
-
} else {
|
|
34
|
-
mockValue = void 0;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (typeof mockValue === "function") {
|
|
39
|
-
return mockValue;
|
|
40
|
-
}
|
|
41
|
-
if (mockValue && typeof mockValue === "object") {
|
|
42
|
-
return createProxy(newPath);
|
|
43
|
-
}
|
|
44
|
-
return createProxy(newPath);
|
|
45
|
-
},
|
|
46
|
-
apply(_, __, args) {
|
|
47
|
-
let mockValue = mocks;
|
|
48
|
-
for (const key of path) {
|
|
49
|
-
if (mockValue && typeof mockValue === "object" && key in mockValue) {
|
|
50
|
-
mockValue = mockValue[key];
|
|
51
|
-
} else {
|
|
52
|
-
mockValue = void 0;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (typeof mockValue === "function") {
|
|
57
|
-
return mockValue(...args);
|
|
58
|
-
}
|
|
59
|
-
throw new Error(
|
|
60
|
-
`Mock not implemented for: ${path.join(".")}. Provide a mock implementation in createMockClient().`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
return createProxy();
|
|
66
|
-
}
|
|
4
|
+
// src/schemas/common.ts
|
|
67
5
|
var TransactionMetadataSchema = z.object({
|
|
68
6
|
type: z.string(),
|
|
69
7
|
description: z.string()
|
|
@@ -90,8 +28,8 @@ var ErrorResponseSchema = z.object({
|
|
|
90
28
|
error: z.string(),
|
|
91
29
|
details: z.array(z.string()).optional()
|
|
92
30
|
});
|
|
93
|
-
var WalletAddressSchema = z.string().
|
|
94
|
-
var PublicKeySchema = z.string().
|
|
31
|
+
var WalletAddressSchema = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "Invalid Solana wallet address");
|
|
32
|
+
var PublicKeySchema = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "Invalid Solana public key");
|
|
95
33
|
var HeliumPublicKeySchema = z.string().min(32).max(400);
|
|
96
34
|
var PaginationInputSchema = z.object({
|
|
97
35
|
page: z.coerce.number().int().min(1).default(1),
|
|
@@ -102,6 +40,182 @@ var PaginationOutputSchema = z.object({
|
|
|
102
40
|
page: z.number(),
|
|
103
41
|
totalPages: z.number()
|
|
104
42
|
});
|
|
43
|
+
var ScheduleInputSchema = z.object({
|
|
44
|
+
frequency: z.enum(["daily", "weekly", "monthly"]),
|
|
45
|
+
time: z.string(),
|
|
46
|
+
timezone: z.string(),
|
|
47
|
+
dayOfWeek: z.string().optional(),
|
|
48
|
+
dayOfMonth: z.string().optional()
|
|
49
|
+
});
|
|
50
|
+
var TokenAmountInputSchema = z.object({
|
|
51
|
+
amount: z.string().describe(
|
|
52
|
+
'Raw token amount in smallest unit (bones). e.g. for a mint with 8 decimals, 1 full token = "100000000"'
|
|
53
|
+
),
|
|
54
|
+
mint: PublicKeySchema.describe("Mint address of the token")
|
|
55
|
+
});
|
|
56
|
+
var TokenAmountOutputSchema = z.object({
|
|
57
|
+
amount: z.string().describe(
|
|
58
|
+
'Raw token amount in smallest unit (bones). e.g. for a mint with 8 decimals, 1 full token = "100000000"'
|
|
59
|
+
),
|
|
60
|
+
decimals: z.number().describe("Number of decimals for the mint"),
|
|
61
|
+
uiAmount: z.number().nullable().describe("Numeric amount if <= Number.MAX_SAFE_INTEGER, otherwise null"),
|
|
62
|
+
uiAmountString: z.string().describe("String representation of the uiAmount"),
|
|
63
|
+
mint: PublicKeySchema.describe("Mint address of the token")
|
|
64
|
+
});
|
|
65
|
+
var RewardSplitInputSchema = z.discriminatedUnion("type", [
|
|
66
|
+
z.object({
|
|
67
|
+
address: WalletAddressSchema,
|
|
68
|
+
type: z.literal("percentage"),
|
|
69
|
+
amount: z.number().describe("0-100 (e.g. 50 = 50%)")
|
|
70
|
+
}),
|
|
71
|
+
z.object({
|
|
72
|
+
address: WalletAddressSchema,
|
|
73
|
+
type: z.literal("fixed"),
|
|
74
|
+
tokenAmount: TokenAmountInputSchema
|
|
75
|
+
})
|
|
76
|
+
]);
|
|
77
|
+
var GetTokensInputSchema = z.object({
|
|
78
|
+
limit: z.coerce.number().int().min(1).max(100).default(50)
|
|
79
|
+
});
|
|
80
|
+
var GetQuoteInputSchema = z.object({
|
|
81
|
+
inputMint: z.string().min(1),
|
|
82
|
+
outputMint: z.string().min(1),
|
|
83
|
+
amount: z.string().min(1),
|
|
84
|
+
swapMode: z.enum(["ExactIn", "ExactOut"]).default("ExactIn"),
|
|
85
|
+
slippageBps: z.coerce.number().min(0).max(1e4).default(50)
|
|
86
|
+
});
|
|
87
|
+
var QuoteResponseSchema = z.object({
|
|
88
|
+
inputMint: z.string(),
|
|
89
|
+
inAmount: z.string(),
|
|
90
|
+
outputMint: z.string(),
|
|
91
|
+
outAmount: z.string(),
|
|
92
|
+
otherAmountThreshold: z.string(),
|
|
93
|
+
swapMode: z.string(),
|
|
94
|
+
slippageBps: z.number(),
|
|
95
|
+
platformFee: z.unknown().optional(),
|
|
96
|
+
priceImpactPct: z.string(),
|
|
97
|
+
routePlan: z.array(z.unknown()),
|
|
98
|
+
contextSlot: z.number().optional(),
|
|
99
|
+
timeTaken: z.number().optional()
|
|
100
|
+
}).passthrough();
|
|
101
|
+
var GetInstructionsInputSchema = z.object({
|
|
102
|
+
quoteResponse: QuoteResponseSchema,
|
|
103
|
+
userPublicKey: z.string().min(1),
|
|
104
|
+
destinationTokenAccount: z.string().optional(),
|
|
105
|
+
dynamicComputeUnitLimit: z.boolean().default(true),
|
|
106
|
+
prioritizationFeeLamports: z.object({
|
|
107
|
+
priorityLevelWithMaxLamports: z.object({
|
|
108
|
+
maxLamports: z.number().default(1e6),
|
|
109
|
+
priorityLevel: z.enum(["low", "medium", "high"]).default("medium")
|
|
110
|
+
})
|
|
111
|
+
}).optional()
|
|
112
|
+
});
|
|
113
|
+
var TokenSchema = z.object({
|
|
114
|
+
address: z.string(),
|
|
115
|
+
symbol: z.string(),
|
|
116
|
+
name: z.string(),
|
|
117
|
+
decimals: z.number(),
|
|
118
|
+
logoURI: z.string().optional(),
|
|
119
|
+
tags: z.array(z.string()).optional()
|
|
120
|
+
});
|
|
121
|
+
var TokenListOutputSchema = z.object({
|
|
122
|
+
tokens: z.array(TokenSchema)
|
|
123
|
+
});
|
|
124
|
+
var SwapTransactionDataSchema = TransactionDataSchema;
|
|
125
|
+
|
|
126
|
+
// src/schemas/fiat.ts
|
|
127
|
+
var InitKycInputSchema = z.object({
|
|
128
|
+
type: z.enum(["individual", "business"]).optional()
|
|
129
|
+
});
|
|
130
|
+
var CreateBankAccountInputSchema = z.object({
|
|
131
|
+
currency: z.string(),
|
|
132
|
+
account_type: z.string(),
|
|
133
|
+
bank_name: z.string(),
|
|
134
|
+
account_name: z.string(),
|
|
135
|
+
first_name: z.string().optional(),
|
|
136
|
+
last_name: z.string().optional(),
|
|
137
|
+
account_owner_name: z.string().optional(),
|
|
138
|
+
business_name: z.string().optional(),
|
|
139
|
+
account: z.object({
|
|
140
|
+
account_number: z.string(),
|
|
141
|
+
routing_number: z.string(),
|
|
142
|
+
checking_or_savings: z.string()
|
|
143
|
+
}),
|
|
144
|
+
address: z.object({
|
|
145
|
+
street_line_1: z.string(),
|
|
146
|
+
line2: z.string().optional(),
|
|
147
|
+
city: z.string(),
|
|
148
|
+
state: z.string(),
|
|
149
|
+
postal_code: z.string(),
|
|
150
|
+
country: z.string()
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
var GetBankAccountInputSchema = z.object({
|
|
154
|
+
id: z.string()
|
|
155
|
+
});
|
|
156
|
+
var DeleteBankAccountInputSchema = z.object({
|
|
157
|
+
id: z.number()
|
|
158
|
+
});
|
|
159
|
+
var GetSendQuoteInputSchema = z.object({
|
|
160
|
+
id: z.string(),
|
|
161
|
+
usdAmount: z.string()
|
|
162
|
+
});
|
|
163
|
+
var SendFundsInputSchema = z.object({
|
|
164
|
+
id: z.string(),
|
|
165
|
+
userAddress: z.string(),
|
|
166
|
+
quoteResponse: QuoteResponseSchema
|
|
167
|
+
});
|
|
168
|
+
var GetTransferInputSchema = z.object({
|
|
169
|
+
id: z.string()
|
|
170
|
+
});
|
|
171
|
+
var UpdateTransferInputSchema = z.object({
|
|
172
|
+
id: z.string(),
|
|
173
|
+
solanaSignature: z.string()
|
|
174
|
+
});
|
|
175
|
+
var KycStatusOutputSchema = z.object({
|
|
176
|
+
kycStatus: z.string(),
|
|
177
|
+
tosStatus: z.string(),
|
|
178
|
+
tosLink: z.string().nullable(),
|
|
179
|
+
kycLink: z.string().nullable(),
|
|
180
|
+
kycLinkId: z.string().nullable(),
|
|
181
|
+
accountType: z.string().optional(),
|
|
182
|
+
rejectionReasons: z.array(z.string()).optional()
|
|
183
|
+
});
|
|
184
|
+
var FeesOutputSchema = z.object({
|
|
185
|
+
developer_fee: z.string(),
|
|
186
|
+
developer_fee_percent: z.number()
|
|
187
|
+
});
|
|
188
|
+
var BankAccountSchema = z.object({
|
|
189
|
+
id: z.number().optional(),
|
|
190
|
+
bridgeUserId: z.number().optional(),
|
|
191
|
+
bridgeExternalAccountId: z.string().optional(),
|
|
192
|
+
accountName: z.string().optional(),
|
|
193
|
+
bankName: z.string().optional(),
|
|
194
|
+
lastFourDigits: z.string().optional(),
|
|
195
|
+
routingNumber: z.string().optional(),
|
|
196
|
+
accountType: z.string().optional(),
|
|
197
|
+
createdAt: z.union([z.string(), z.date()]).optional(),
|
|
198
|
+
updatedAt: z.union([z.string(), z.date()]).optional()
|
|
199
|
+
}).passthrough();
|
|
200
|
+
var BankAccountListOutputSchema = z.array(BankAccountSchema);
|
|
201
|
+
var DeleteBankAccountOutputSchema = z.object({
|
|
202
|
+
success: z.boolean()
|
|
203
|
+
});
|
|
204
|
+
var BridgeTransferSchema = z.object({
|
|
205
|
+
id: z.string(),
|
|
206
|
+
state: z.string(),
|
|
207
|
+
source_deposit_instructions: z.object({
|
|
208
|
+
to_address: z.string()
|
|
209
|
+
})
|
|
210
|
+
}).passthrough();
|
|
211
|
+
var SendFundsOutputSchema = z.object({
|
|
212
|
+
bridgeTransfer: BridgeTransferSchema,
|
|
213
|
+
transactionData: TransactionDataSchema
|
|
214
|
+
});
|
|
215
|
+
var UpdateTransferOutputSchema = z.object({
|
|
216
|
+
success: z.boolean()
|
|
217
|
+
});
|
|
218
|
+
var QuoteOutputSchema = QuoteResponseSchema;
|
|
105
219
|
var HealthResponseSchema = z.object({
|
|
106
220
|
ok: z.boolean(),
|
|
107
221
|
error: z.string().optional()
|
|
@@ -111,10 +225,8 @@ var GetBalancesInputSchema = z.object({
|
|
|
111
225
|
});
|
|
112
226
|
var TransferInputSchema = z.object({
|
|
113
227
|
walletAddress: WalletAddressSchema,
|
|
114
|
-
mint: z.string().nullable().optional(),
|
|
115
228
|
destination: z.string().min(32),
|
|
116
|
-
|
|
117
|
-
decimals: z.number().optional()
|
|
229
|
+
tokenAmount: TokenAmountInputSchema
|
|
118
230
|
});
|
|
119
231
|
var CreateHntAccountInputSchema = z.object({
|
|
120
232
|
walletAddress: WalletAddressSchema
|
|
@@ -145,78 +257,78 @@ var CreateHntAccountOutputSchema = z.object({
|
|
|
145
257
|
});
|
|
146
258
|
var HotspotTypeSchema = z.enum(["iot", "mobile", "all"]);
|
|
147
259
|
var GetHotspotsInputSchema = z.object({
|
|
148
|
-
walletAddress:
|
|
260
|
+
walletAddress: WalletAddressSchema,
|
|
149
261
|
type: HotspotTypeSchema.optional(),
|
|
150
262
|
page: z.coerce.number().int().min(1).default(1),
|
|
151
263
|
limit: z.coerce.number().int().min(1).max(100).default(10)
|
|
152
264
|
});
|
|
153
265
|
var ClaimRewardsInputSchema = z.object({
|
|
154
|
-
walletAddress:
|
|
266
|
+
walletAddress: WalletAddressSchema
|
|
155
267
|
});
|
|
156
268
|
var GetPendingRewardsInputSchema = z.object({
|
|
157
|
-
walletAddress:
|
|
269
|
+
walletAddress: WalletAddressSchema
|
|
270
|
+
});
|
|
271
|
+
var PendingRewards = z.object({
|
|
272
|
+
total: TokenAmountOutputSchema.describe("Total rewards pending for the requested wallet, including rewards which may be directly claimable or paid indirectly through automation to this wallet."),
|
|
273
|
+
claimable: TokenAmountOutputSchema.describe("Total rewards that can be manually claimed now. Should be a subset of total."),
|
|
274
|
+
automated: TokenAmountOutputSchema.describe("Total rewards that are pending but will be automatically claimed in the future based on existing automation setups. Should be a subset of total.")
|
|
275
|
+
});
|
|
276
|
+
var GetPendingRewardsOutputSchema = z.object({
|
|
277
|
+
pending: PendingRewards.describe("Total rewards pending for the requested wallet - across all relevant hotspots."),
|
|
278
|
+
byHotspot: z.array(z.object({
|
|
279
|
+
hotspotPubKey: HeliumPublicKeySchema,
|
|
280
|
+
pending: PendingRewards
|
|
281
|
+
}))
|
|
158
282
|
});
|
|
159
283
|
var TransferHotspotInputSchema = z.object({
|
|
160
|
-
walletAddress:
|
|
161
|
-
hotspotPubkey:
|
|
162
|
-
recipient:
|
|
284
|
+
walletAddress: WalletAddressSchema,
|
|
285
|
+
hotspotPubkey: HeliumPublicKeySchema,
|
|
286
|
+
recipient: WalletAddressSchema
|
|
163
287
|
});
|
|
164
288
|
var UpdateRewardsDestinationInputSchema = z.object({
|
|
165
|
-
walletAddress:
|
|
166
|
-
hotspotPubkey:
|
|
167
|
-
destination:
|
|
289
|
+
walletAddress: WalletAddressSchema,
|
|
290
|
+
hotspotPubkey: HeliumPublicKeySchema,
|
|
291
|
+
destination: WalletAddressSchema,
|
|
168
292
|
lazyDistributors: z.array(z.string().min(32)).min(1)
|
|
169
293
|
});
|
|
170
294
|
var GetSplitInputSchema = z.object({
|
|
171
|
-
walletAddress:
|
|
172
|
-
hotspotPubkey:
|
|
173
|
-
});
|
|
174
|
-
var RewardSplitInputSchema = z.object({
|
|
175
|
-
address: z.string().min(32),
|
|
176
|
-
type: z.enum(["percentage", "fixed"]),
|
|
177
|
-
amount: z.number()
|
|
178
|
-
});
|
|
179
|
-
var ScheduleInputSchema = z.object({
|
|
180
|
-
frequency: z.enum(["daily", "weekly", "monthly"]),
|
|
181
|
-
time: z.string(),
|
|
182
|
-
timezone: z.string(),
|
|
183
|
-
dayOfWeek: z.string().optional(),
|
|
184
|
-
dayOfMonth: z.string().optional()
|
|
295
|
+
walletAddress: WalletAddressSchema,
|
|
296
|
+
hotspotPubkey: HeliumPublicKeySchema
|
|
185
297
|
});
|
|
186
298
|
var CreateSplitInputSchema = z.object({
|
|
187
|
-
walletAddress:
|
|
188
|
-
hotspotPubkey:
|
|
299
|
+
walletAddress: WalletAddressSchema,
|
|
300
|
+
hotspotPubkey: HeliumPublicKeySchema,
|
|
189
301
|
rewardsSplit: z.array(RewardSplitInputSchema),
|
|
190
302
|
schedule: ScheduleInputSchema,
|
|
191
303
|
lazyDistributor: z.string().min(32)
|
|
192
304
|
});
|
|
193
305
|
var DeleteSplitInputSchema = z.object({
|
|
194
|
-
walletAddress:
|
|
195
|
-
hotspotPubkey:
|
|
306
|
+
walletAddress: WalletAddressSchema,
|
|
307
|
+
hotspotPubkey: HeliumPublicKeySchema
|
|
196
308
|
});
|
|
197
309
|
var GetAutomationStatusInputSchema = z.object({
|
|
198
|
-
walletAddress:
|
|
310
|
+
walletAddress: WalletAddressSchema
|
|
199
311
|
});
|
|
200
312
|
var AutomationScheduleSchema = z.enum(["daily", "weekly", "monthly"]);
|
|
201
313
|
var SetupAutomationInputSchema = z.object({
|
|
202
|
-
walletAddress:
|
|
314
|
+
walletAddress: WalletAddressSchema,
|
|
203
315
|
schedule: AutomationScheduleSchema,
|
|
204
316
|
duration: z.number().int().min(1),
|
|
205
317
|
// Number of claims
|
|
206
318
|
totalHotspots: z.number().int().min(1)
|
|
207
319
|
});
|
|
208
320
|
var FundAutomationInputSchema = z.object({
|
|
209
|
-
walletAddress:
|
|
321
|
+
walletAddress: WalletAddressSchema,
|
|
210
322
|
additionalDuration: z.number().int().min(1)
|
|
211
323
|
// Additional number of claims
|
|
212
324
|
});
|
|
213
325
|
var GetFundingEstimateInputSchema = z.object({
|
|
214
|
-
walletAddress:
|
|
326
|
+
walletAddress: WalletAddressSchema,
|
|
215
327
|
duration: z.coerce.number().int().min(1)
|
|
216
328
|
// Number of claims to estimate funding for
|
|
217
329
|
});
|
|
218
330
|
var CloseAutomationInputSchema = z.object({
|
|
219
|
-
walletAddress:
|
|
331
|
+
walletAddress: WalletAddressSchema
|
|
220
332
|
});
|
|
221
333
|
var DeviceTypeSchema = z.enum([
|
|
222
334
|
"iot-gateway",
|
|
@@ -263,7 +375,7 @@ var UpdateRewardsDestinationOutputSchema = z.object({
|
|
|
263
375
|
var SplitShareSchema = z.object({
|
|
264
376
|
wallet: z.string(),
|
|
265
377
|
delegate: z.string(),
|
|
266
|
-
fixed:
|
|
378
|
+
fixed: TokenAmountOutputSchema,
|
|
267
379
|
shares: z.number()
|
|
268
380
|
});
|
|
269
381
|
var SplitResponseSchema = z.object({
|
|
@@ -278,9 +390,6 @@ var CreateSplitOutputSchema = z.object({
|
|
|
278
390
|
var DeleteSplitOutputSchema = z.object({
|
|
279
391
|
transactionData: TransactionDataSchema
|
|
280
392
|
});
|
|
281
|
-
var PendingRewardsOutputSchema = z.object({
|
|
282
|
-
pending: z.string()
|
|
283
|
-
});
|
|
284
393
|
var AutomationStatusOutputSchema = z.object({
|
|
285
394
|
hasExistingAutomation: z.boolean(),
|
|
286
395
|
isOutOfSol: z.boolean(),
|
|
@@ -291,8 +400,11 @@ var AutomationStatusOutputSchema = z.object({
|
|
|
291
400
|
// ISO date string
|
|
292
401
|
}).optional(),
|
|
293
402
|
rentFee: z.number(),
|
|
403
|
+
// Initial setup rent (BASE_AUTOMATION_RENT + TASK_RETURN_ACCOUNT_SIZE) if automation doesn't exist, 0 otherwise
|
|
294
404
|
recipientFee: z.number(),
|
|
295
|
-
|
|
405
|
+
// SOL needed for recipient accounts (if any)
|
|
406
|
+
operationalSol: z.number(),
|
|
407
|
+
// Total operational SOL needed for automation claims (cronJobFunding + pdaWalletFunding)
|
|
296
408
|
remainingClaims: z.number().optional(),
|
|
297
409
|
fundingPeriodInfo: z.object({
|
|
298
410
|
periodLength: AutomationScheduleSchema,
|
|
@@ -316,85 +428,235 @@ var CloseAutomationOutputSchema = z.object({
|
|
|
316
428
|
transactionData: TransactionDataSchema
|
|
317
429
|
});
|
|
318
430
|
var FundingEstimateOutputSchema = z.object({
|
|
431
|
+
rentFee: z.number(),
|
|
432
|
+
// Initial setup rent (BASE_AUTOMATION_RENT + TASK_RETURN_ACCOUNT_SIZE) if automation doesn't exist, 0 otherwise
|
|
319
433
|
cronJobFunding: z.number(),
|
|
320
|
-
// SOL needed for cron job account
|
|
434
|
+
// SOL needed for cron job account operations
|
|
321
435
|
pdaWalletFunding: z.number(),
|
|
322
|
-
// SOL needed for PDA wallet
|
|
436
|
+
// SOL needed for PDA wallet operations
|
|
323
437
|
recipientFee: z.number(),
|
|
324
438
|
// SOL needed for recipient accounts (if any)
|
|
325
|
-
|
|
326
|
-
// Total SOL needed
|
|
439
|
+
operationalSol: z.number(),
|
|
440
|
+
// Total operational SOL needed for automation claims (cronJobFunding + pdaWalletFunding)
|
|
441
|
+
totalSolNeeded: z.number(),
|
|
442
|
+
// Total SOL needed including all fees (rentFee + operationalSol + recipientFee)
|
|
327
443
|
currentCronJobBalance: z.string(),
|
|
328
444
|
// Current balance in cronJob (lamports as string)
|
|
329
|
-
currentPdaWalletBalance: z.string()
|
|
445
|
+
currentPdaWalletBalance: z.string()
|
|
330
446
|
// Current balance in pdaWallet (lamports as string)
|
|
331
|
-
additionalFundingNeeded: z.number()
|
|
332
|
-
// Net additional funding required (SOL)
|
|
333
447
|
});
|
|
334
|
-
var
|
|
448
|
+
var WifiDeploymentInfoSchema = z.object({
|
|
449
|
+
type: z.literal("WIFI"),
|
|
450
|
+
antenna: z.number().int(),
|
|
451
|
+
elevation: z.number(),
|
|
452
|
+
azimuth: z.number().min(0).max(360),
|
|
453
|
+
mechanicalDownTilt: z.number(),
|
|
454
|
+
electricalDownTilt: z.number(),
|
|
455
|
+
serial: z.string().optional()
|
|
456
|
+
});
|
|
457
|
+
var CbrsRadioInfoSchema = z.object({
|
|
458
|
+
radioId: z.string(),
|
|
459
|
+
elevation: z.number()
|
|
460
|
+
});
|
|
461
|
+
var CbrsDeploymentInfoSchema = z.object({
|
|
462
|
+
type: z.literal("CBRS"),
|
|
463
|
+
radioInfos: z.array(CbrsRadioInfoSchema).min(1)
|
|
464
|
+
});
|
|
465
|
+
var DeploymentInfoSchema = z.discriminatedUnion("type", [
|
|
466
|
+
WifiDeploymentInfoSchema,
|
|
467
|
+
CbrsDeploymentInfoSchema
|
|
468
|
+
]);
|
|
469
|
+
var LocationSchema = z.object({
|
|
470
|
+
lat: z.number().min(-90).max(90),
|
|
471
|
+
lng: z.number().min(-180).max(180)
|
|
472
|
+
});
|
|
473
|
+
var IotUpdateSchema = z.object({
|
|
474
|
+
deviceType: z.literal("iot"),
|
|
335
475
|
entityPubKey: HeliumPublicKeySchema,
|
|
336
476
|
walletAddress: WalletAddressSchema,
|
|
337
|
-
location:
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}),
|
|
477
|
+
location: LocationSchema.optional(),
|
|
478
|
+
gain: z.number().optional(),
|
|
479
|
+
elevation: z.number().optional(),
|
|
341
480
|
azimuth: z.number().min(0).max(360).optional()
|
|
342
481
|
});
|
|
343
|
-
var
|
|
344
|
-
|
|
482
|
+
var MobileUpdateSchema = z.object({
|
|
483
|
+
deviceType: z.literal("mobile"),
|
|
484
|
+
entityPubKey: HeliumPublicKeySchema,
|
|
485
|
+
walletAddress: WalletAddressSchema,
|
|
486
|
+
location: LocationSchema.optional(),
|
|
487
|
+
deploymentInfo: DeploymentInfoSchema.optional()
|
|
345
488
|
});
|
|
346
|
-
var
|
|
347
|
-
|
|
489
|
+
var UpdateHotspotInfoInputSchema = z.discriminatedUnion("deviceType", [
|
|
490
|
+
IotUpdateSchema,
|
|
491
|
+
MobileUpdateSchema
|
|
492
|
+
]);
|
|
493
|
+
var UpdateHotspotInfoOutputSchema = z.object({
|
|
494
|
+
transactionData: TransactionDataSchema,
|
|
495
|
+
appliedTo: z.object({
|
|
496
|
+
iot: z.boolean(),
|
|
497
|
+
mobile: z.boolean()
|
|
498
|
+
})
|
|
348
499
|
});
|
|
349
|
-
var
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
500
|
+
var RewardSchedule = z.string().describe("UTC cron expression (e.g. '0 30 9 * * *')");
|
|
501
|
+
var RecipientShareInput = z.discriminatedUnion("type", [
|
|
502
|
+
z.object({
|
|
503
|
+
type: z.literal("FIXED"),
|
|
504
|
+
tokenAmount: TokenAmountInputSchema
|
|
505
|
+
}),
|
|
506
|
+
z.object({
|
|
507
|
+
type: z.literal("SHARES"),
|
|
508
|
+
shares: z.number().int().min(1).max(100).describe("Percentage share of rewards")
|
|
509
|
+
})
|
|
510
|
+
]);
|
|
511
|
+
var RecipientShareOutput = z.discriminatedUnion("type", [
|
|
512
|
+
z.object({
|
|
513
|
+
type: z.literal("FIXED"),
|
|
514
|
+
tokenAmount: TokenAmountOutputSchema
|
|
515
|
+
}),
|
|
516
|
+
z.object({
|
|
517
|
+
type: z.literal("SHARES"),
|
|
518
|
+
shares: z.number().int().min(1).max(100).describe("Percentage share of rewards")
|
|
519
|
+
})
|
|
520
|
+
]);
|
|
521
|
+
var RecipientConfigInput = z.discriminatedUnion("type", [
|
|
522
|
+
z.object({
|
|
523
|
+
type: z.literal("PRESET"),
|
|
524
|
+
walletAddress: WalletAddressSchema.describe(
|
|
525
|
+
"The wallet address of a preconfigured recipient"
|
|
526
|
+
),
|
|
527
|
+
receives: RecipientShareInput
|
|
528
|
+
}).describe("A recipient that uses a preset configuration"),
|
|
529
|
+
z.object({
|
|
530
|
+
type: z.literal("CLAIMABLE"),
|
|
531
|
+
giftedCurrency: TokenAmountInputSchema.describe(
|
|
532
|
+
"The amount of currency bundled in the contract, and gifted to the claimer upon creation"
|
|
533
|
+
),
|
|
534
|
+
receives: RecipientShareInput
|
|
535
|
+
}).describe(
|
|
536
|
+
"A recipient that in yet unknown, but will claim the pending contract"
|
|
537
|
+
)
|
|
538
|
+
]);
|
|
539
|
+
var RecipientConfigOutput = z.discriminatedUnion("type", [
|
|
540
|
+
z.object({
|
|
541
|
+
type: z.literal("PRESET"),
|
|
542
|
+
walletAddress: WalletAddressSchema.describe(
|
|
543
|
+
"The wallet address of a preconfigured recipient"
|
|
544
|
+
),
|
|
545
|
+
receives: RecipientShareOutput
|
|
546
|
+
}).describe("A recipient that uses a preset configuration"),
|
|
547
|
+
z.object({
|
|
548
|
+
type: z.literal("CLAIMABLE"),
|
|
549
|
+
giftedCurrency: TokenAmountOutputSchema.describe(
|
|
550
|
+
"The amount of currency bundled in the contract, and gifted to the claimer upon creation"
|
|
551
|
+
),
|
|
552
|
+
receives: RecipientShareOutput
|
|
553
|
+
}).describe(
|
|
554
|
+
"A recipient that in yet unknown, but will claim the pending contract"
|
|
555
|
+
)
|
|
556
|
+
]);
|
|
557
|
+
var PendingRewardContract = z.object({
|
|
558
|
+
delegateWalletAddress: WalletAddressSchema.describe(
|
|
559
|
+
"The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the pending contract."
|
|
560
|
+
),
|
|
561
|
+
recipients: z.array(RecipientConfigOutput).min(1).max(6).describe(
|
|
562
|
+
"An exhaustive list of recipients and their respective shares in the reward contract"
|
|
563
|
+
),
|
|
564
|
+
rewardSchedule: RewardSchedule.describe(
|
|
565
|
+
"The schedule on which rewards would be distributed to recipients"
|
|
566
|
+
)
|
|
355
567
|
});
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}).passthrough();
|
|
370
|
-
var GetInstructionsInputSchema = z.object({
|
|
371
|
-
quoteResponse: QuoteResponseSchema,
|
|
372
|
-
userPublicKey: z.string().min(1),
|
|
373
|
-
destinationTokenAccount: z.string().optional(),
|
|
374
|
-
dynamicComputeUnitLimit: z.boolean().default(true),
|
|
375
|
-
prioritizationFeeLamports: z.object({
|
|
376
|
-
priorityLevelWithMaxLamports: z.object({
|
|
377
|
-
maxLamports: z.number().default(1e6),
|
|
378
|
-
priorityLevel: z.enum(["low", "medium", "high"]).default("medium")
|
|
568
|
+
var ActiveRewardContract = z.object({
|
|
569
|
+
delegateWalletAddress: WalletAddressSchema.describe(
|
|
570
|
+
"The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the active contract."
|
|
571
|
+
),
|
|
572
|
+
entityOwnerAddress: WalletAddressSchema.describe(
|
|
573
|
+
"The wallet address that owns the entity (hotspot)"
|
|
574
|
+
),
|
|
575
|
+
recipients: z.array(
|
|
576
|
+
z.object({
|
|
577
|
+
walletAddress: WalletAddressSchema.describe(
|
|
578
|
+
"The wallet address of the reward recipient"
|
|
579
|
+
),
|
|
580
|
+
receives: RecipientShareOutput
|
|
379
581
|
})
|
|
380
|
-
|
|
582
|
+
).min(1).max(6).describe(
|
|
583
|
+
"An exhaustive list of recipients and their respective shares in the reward contract"
|
|
584
|
+
),
|
|
585
|
+
rewardSchedule: RewardSchedule.describe(
|
|
586
|
+
"The schedule on which rewards are distributed to recipients"
|
|
587
|
+
)
|
|
381
588
|
});
|
|
382
|
-
var
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
589
|
+
var FindRewardContractResponseSchema = z.discriminatedUnion("status", [
|
|
590
|
+
z.object({
|
|
591
|
+
status: z.literal("PENDING"),
|
|
592
|
+
contract: PendingRewardContract
|
|
593
|
+
}),
|
|
594
|
+
z.object({
|
|
595
|
+
status: z.literal("ACTIVE"),
|
|
596
|
+
contract: ActiveRewardContract
|
|
597
|
+
}),
|
|
598
|
+
z.object({
|
|
599
|
+
status: z.literal("NONE")
|
|
600
|
+
})
|
|
601
|
+
]);
|
|
602
|
+
var CreateRewardContractTransactionInputSchema = z.object({
|
|
603
|
+
delegateWalletAddress: WalletAddressSchema.describe(
|
|
604
|
+
"The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the contract."
|
|
605
|
+
),
|
|
606
|
+
recipients: z.array(RecipientConfigInput).min(1).max(6).refine((arr) => arr.filter((s) => s.type === "CLAIMABLE").length <= 1, {
|
|
607
|
+
message: "At most one recipient can be of type CLAIMABLE."
|
|
608
|
+
}).refine(
|
|
609
|
+
(arr) => {
|
|
610
|
+
const shareEntries = arr.filter((s) => s.receives.type === "SHARES");
|
|
611
|
+
if (shareEntries.length === 0) {
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
return shareEntries.reduce(
|
|
615
|
+
(acc, curr) => acc + (curr.receives.type === "SHARES" ? curr.receives.shares : 0),
|
|
616
|
+
0
|
|
617
|
+
) === 100;
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
message: "Total shares must equal 100."
|
|
621
|
+
}
|
|
622
|
+
).describe(
|
|
623
|
+
"An exhaustive list of recipients and their respective shares in the reward contract"
|
|
624
|
+
),
|
|
625
|
+
rewardSchedule: RewardSchedule.describe(
|
|
626
|
+
"The schedule on which rewards would be distributed to recipients"
|
|
627
|
+
)
|
|
389
628
|
});
|
|
390
|
-
var
|
|
391
|
-
|
|
629
|
+
var CreateRewardContractTransactionResponseSchema = z.object({
|
|
630
|
+
unsignedTransactionData: TransactionDataSchema.describe(
|
|
631
|
+
"The unsigned transaction data which, when signed and submitted will create the pending or finalized reward contract"
|
|
632
|
+
)
|
|
633
|
+
});
|
|
634
|
+
var DeleteRewardContractTransactionResponseSchema = z.object({
|
|
635
|
+
unsignedTransactionData: TransactionDataSchema.describe(
|
|
636
|
+
"The unsigned transaction data which, when signed and submitted will delete the contract"
|
|
637
|
+
)
|
|
638
|
+
});
|
|
639
|
+
var CreateInviteResponseSchema = z.object({
|
|
640
|
+
unsignedMessage: z.string().min(1).describe(
|
|
641
|
+
"The unsigned invite message which, when signed by the delegate's wallet, can be used by a recipient to claim the pending contract."
|
|
642
|
+
),
|
|
643
|
+
expiration: z.iso.datetime()
|
|
644
|
+
});
|
|
645
|
+
var ClaimInviteRequestSchema = z.object({
|
|
646
|
+
delegateSignature: z.string().min(1).describe("The signed invite message provided by the contract delegate."),
|
|
647
|
+
expiration: z.iso.datetime()
|
|
648
|
+
});
|
|
649
|
+
var ClaimInviteResponseSchema = z.object({
|
|
650
|
+
unsignedTransactionData: TransactionDataSchema.describe(
|
|
651
|
+
"The unsigned transaction data which, when signed and submitted will claim the pending reward contract"
|
|
652
|
+
)
|
|
392
653
|
});
|
|
393
|
-
var SwapTransactionDataSchema = TransactionDataSchema;
|
|
394
654
|
var SubmitInputSchema = z.object({
|
|
395
655
|
transactions: z.array(TransactionItemSchema),
|
|
396
656
|
parallel: z.boolean(),
|
|
397
|
-
tag: z.string().optional()
|
|
657
|
+
tag: z.string().optional(),
|
|
658
|
+
simulationCommitment: z.enum(["confirmed", "finalized"]).optional().default("confirmed"),
|
|
659
|
+
simulate: z.boolean().optional().default(true)
|
|
398
660
|
});
|
|
399
661
|
var GetInputSchema = z.object({
|
|
400
662
|
id: z.string(),
|
|
@@ -482,7 +744,7 @@ var WelcomePackListInputSchema = z.object({
|
|
|
482
744
|
var WelcomePackCreateInputSchema = z.object({
|
|
483
745
|
walletAddress: WalletAddressSchema,
|
|
484
746
|
assetId: z.string(),
|
|
485
|
-
solAmount:
|
|
747
|
+
solAmount: TokenAmountInputSchema,
|
|
486
748
|
rentRefund: z.string(),
|
|
487
749
|
assetReturnAddress: z.string(),
|
|
488
750
|
rewardsSplit: z.array(RewardSplitInputSchema),
|
|
@@ -626,7 +888,7 @@ var hotspotsContract = oc.tag("Hotspot").prefix("/hotspots").router({
|
|
|
626
888
|
INSUFFICIENT_FUNDS
|
|
627
889
|
}),
|
|
628
890
|
/** Public: Get pending rewards for a wallet */
|
|
629
|
-
getPendingRewards: oc.route({ method: "GET", path: "/pending-rewards/{walletAddress}", summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(
|
|
891
|
+
getPendingRewards: oc.route({ method: "GET", path: "/pending-rewards/{walletAddress}", summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(GetPendingRewardsOutputSchema).errors({
|
|
630
892
|
BAD_REQUEST: { message: "Invalid wallet address", status: 400 },
|
|
631
893
|
INVALID_WALLET_ADDRESS
|
|
632
894
|
}),
|
|
@@ -657,31 +919,118 @@ var hotspotsContract = oc.tag("Hotspot").prefix("/hotspots").router({
|
|
|
657
919
|
NOT_FOUND
|
|
658
920
|
}),
|
|
659
921
|
/** Protected: Close automation */
|
|
660
|
-
closeAutomation: oc.route({ method: "POST", path: "/
|
|
922
|
+
closeAutomation: oc.route({ method: "POST", path: "/wallet/{walletAddress}/automation/close", summary: "Close automation" }).input(CloseAutomationInputSchema).output(CloseAutomationOutputSchema).errors({
|
|
661
923
|
NOT_FOUND
|
|
662
924
|
}),
|
|
663
925
|
/** Protected: Get automation status */
|
|
664
|
-
getAutomationStatus: oc.route({ method: "GET", path: "/
|
|
926
|
+
getAutomationStatus: oc.route({ method: "GET", path: "/wallet/{walletAddress}/automation/status", summary: "Get automation status" }).input(GetAutomationStatusInputSchema).output(AutomationStatusOutputSchema).errors({
|
|
665
927
|
NOT_FOUND
|
|
666
928
|
}),
|
|
667
929
|
/** Protected: Create automation */
|
|
668
930
|
createAutomation: oc.route({
|
|
669
931
|
method: "POST",
|
|
670
|
-
path: "/
|
|
932
|
+
path: "/wallet/{walletAddress}/automation",
|
|
671
933
|
summary: "Setup automation"
|
|
672
934
|
}).input(SetupAutomationInputSchema).output(SetupAutomationOutputSchema).errors({
|
|
673
935
|
NOT_FOUND
|
|
674
936
|
}),
|
|
675
937
|
/** Protected: Fund automation */
|
|
676
|
-
fundAutomation: oc.route({ method: "POST", path: "/
|
|
938
|
+
fundAutomation: oc.route({ method: "POST", path: "/wallet/{walletAddress}/automation/fund", summary: "Fund automation" }).input(FundAutomationInputSchema).output(FundAutomationOutputSchema).errors({
|
|
677
939
|
NOT_FOUND,
|
|
678
940
|
INSUFFICIENT_FUNDS
|
|
679
941
|
}),
|
|
680
942
|
/** Protected: Get funding estimate */
|
|
681
|
-
getFundingEstimate: oc.route({ method: "GET", path: "/
|
|
682
|
-
|
|
943
|
+
getFundingEstimate: oc.route({ method: "GET", path: "/wallet/{walletAddress}/automation/funding-estimate", summary: "Get funding estimate" }).input(GetFundingEstimateInputSchema).output(FundingEstimateOutputSchema).errors({}),
|
|
944
|
+
updateHotspotInfo: oc.route({ method: "POST", path: "/update-info", summary: "Update hotspot info", description: "Creates an unsigned transaction to update hotspot configuration. Requires deviceType discriminant (iot or mobile) to select the correct update path and validate against on-chain network." }).input(UpdateHotspotInfoInputSchema).output(UpdateHotspotInfoOutputSchema).errors({
|
|
945
|
+
NOT_FOUND,
|
|
946
|
+
UNAUTHORIZED,
|
|
947
|
+
BAD_REQUEST: { message: "Device type mismatch", status: 400 }
|
|
683
948
|
})
|
|
684
949
|
});
|
|
950
|
+
var rewardContract = oc.tag("Reward Contract").prefix("/hotspots").router({
|
|
951
|
+
find: oc.route({
|
|
952
|
+
method: "GET",
|
|
953
|
+
path: "/{entityPubKey}/reward-contract",
|
|
954
|
+
summary: "Get Contract",
|
|
955
|
+
description: "Retrieves the reward contract (pending or active) associated with a specific hotspot entity."
|
|
956
|
+
}).input(z.object({
|
|
957
|
+
entityPubKey: HeliumPublicKeySchema
|
|
958
|
+
})).errors({
|
|
959
|
+
NOT_FOUND,
|
|
960
|
+
BAD_REQUEST
|
|
961
|
+
}).output(FindRewardContractResponseSchema),
|
|
962
|
+
create: oc.route({
|
|
963
|
+
method: "POST",
|
|
964
|
+
path: "/{entityPubKey}/reward-contract",
|
|
965
|
+
summary: "Create Reward Contract",
|
|
966
|
+
description: "Assembles an unsigned transaction to create a claimable or finalized reward contract for a specific hotspot entity. If the input inlcudes a pending/claimable recipient, the contract will be created as a pending/claimable contract. If the input is defined exclusively with preset recipients, an active contract will be created directly."
|
|
967
|
+
}).input(
|
|
968
|
+
CreateRewardContractTransactionInputSchema.extend({
|
|
969
|
+
entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
|
|
970
|
+
signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
|
|
971
|
+
})
|
|
972
|
+
).errors({
|
|
973
|
+
BAD_REQUEST,
|
|
974
|
+
CONFLICT,
|
|
975
|
+
NOT_FOUND,
|
|
976
|
+
UNAUTHORIZED,
|
|
977
|
+
// Does this belong here to guard gifted currency check?
|
|
978
|
+
INSUFFICIENT_FUNDS
|
|
979
|
+
}).output(CreateRewardContractTransactionResponseSchema),
|
|
980
|
+
delete: oc.route({
|
|
981
|
+
method: "DELETE",
|
|
982
|
+
path: "/{entityPubKey}/reward-contract",
|
|
983
|
+
summary: "Delete Pending Contract",
|
|
984
|
+
description: "Assembles an unsigned transaction to delete a reward contract (pending or active) for a specific hotspot entity."
|
|
985
|
+
}).input(
|
|
986
|
+
z.object({
|
|
987
|
+
entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
|
|
988
|
+
signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
|
|
989
|
+
})
|
|
990
|
+
).errors({
|
|
991
|
+
BAD_REQUEST,
|
|
992
|
+
NOT_FOUND,
|
|
993
|
+
// if wallet is not the delegate
|
|
994
|
+
UNAUTHORIZED
|
|
995
|
+
}).output(DeleteRewardContractTransactionResponseSchema),
|
|
996
|
+
invite: oc.route({
|
|
997
|
+
method: "POST",
|
|
998
|
+
path: "/{entityPubKey}/reward-contract/invite",
|
|
999
|
+
summary: "Create Invite",
|
|
1000
|
+
description: "Assembles details required to create a shareable invite to claim a pending reward contract."
|
|
1001
|
+
}).input(
|
|
1002
|
+
z.object({
|
|
1003
|
+
entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
|
|
1004
|
+
signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller"),
|
|
1005
|
+
expirationDays: z.number().int().positive().max(365).default(7).describe("Number of days until the invite expires")
|
|
1006
|
+
})
|
|
1007
|
+
).errors({
|
|
1008
|
+
// if no hotspot or contract found
|
|
1009
|
+
NOT_FOUND,
|
|
1010
|
+
// if the contract is not pending
|
|
1011
|
+
BAD_REQUEST,
|
|
1012
|
+
// if wallet is not the delegate
|
|
1013
|
+
UNAUTHORIZED
|
|
1014
|
+
}).output(CreateInviteResponseSchema),
|
|
1015
|
+
claim: oc.route({
|
|
1016
|
+
method: "POST",
|
|
1017
|
+
path: "/{entityPubKey}/reward-contract/claim",
|
|
1018
|
+
summary: "Claim Invite",
|
|
1019
|
+
description: "Assembles an unsigned transaction which can be used to claim an invite."
|
|
1020
|
+
}).input(
|
|
1021
|
+
ClaimInviteRequestSchema.extend({
|
|
1022
|
+
entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
|
|
1023
|
+
signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
|
|
1024
|
+
})
|
|
1025
|
+
).errors({
|
|
1026
|
+
// if no hotspot or contract found
|
|
1027
|
+
NOT_FOUND,
|
|
1028
|
+
// if the contract is not pending
|
|
1029
|
+
BAD_REQUEST,
|
|
1030
|
+
// if wallet is not the delegate
|
|
1031
|
+
UNAUTHORIZED
|
|
1032
|
+
}).output(ClaimInviteResponseSchema)
|
|
1033
|
+
});
|
|
685
1034
|
var swapContract = oc.tag("Swap").router({
|
|
686
1035
|
getTokens: oc.route({ method: "GET", path: "/swap/tokens" }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
|
|
687
1036
|
JUPITER_ERROR: { message: "Failed to fetch tokens from Jupiter" }
|
|
@@ -722,7 +1071,8 @@ var welcomePacksContract = oc.tag("Welcome Packs").router({
|
|
|
722
1071
|
}),
|
|
723
1072
|
/** Protected: Create a new welcome pack */
|
|
724
1073
|
create: oc.route({ method: "POST", path: "/welcome-packs", summary: "Create a new welcome pack" }).input(WelcomePackCreateInputSchema).output(WelcomePackCreateOutputSchema).errors({
|
|
725
|
-
BAD_REQUEST
|
|
1074
|
+
BAD_REQUEST,
|
|
1075
|
+
CONFLICT
|
|
726
1076
|
}),
|
|
727
1077
|
/** Public: Get a specific welcome pack */
|
|
728
1078
|
get: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Get a specific welcome pack" }).input(WelcomePackGetInputSchema).output(WelcomePackSchema).errors({
|
|
@@ -749,98 +1099,6 @@ var welcomePacksContract = oc.tag("Welcome Packs").router({
|
|
|
749
1099
|
NOT_FOUND
|
|
750
1100
|
})
|
|
751
1101
|
});
|
|
752
|
-
var InitKycInputSchema = z.object({
|
|
753
|
-
type: z.enum(["individual", "business"]).optional()
|
|
754
|
-
});
|
|
755
|
-
var CreateBankAccountInputSchema = z.object({
|
|
756
|
-
currency: z.string(),
|
|
757
|
-
account_type: z.string(),
|
|
758
|
-
bank_name: z.string(),
|
|
759
|
-
account_name: z.string(),
|
|
760
|
-
first_name: z.string().optional(),
|
|
761
|
-
last_name: z.string().optional(),
|
|
762
|
-
account_owner_name: z.string().optional(),
|
|
763
|
-
business_name: z.string().optional(),
|
|
764
|
-
account: z.object({
|
|
765
|
-
account_number: z.string(),
|
|
766
|
-
routing_number: z.string(),
|
|
767
|
-
checking_or_savings: z.string()
|
|
768
|
-
}),
|
|
769
|
-
address: z.object({
|
|
770
|
-
street_line_1: z.string(),
|
|
771
|
-
line2: z.string().optional(),
|
|
772
|
-
city: z.string(),
|
|
773
|
-
state: z.string(),
|
|
774
|
-
postal_code: z.string(),
|
|
775
|
-
country: z.string()
|
|
776
|
-
})
|
|
777
|
-
});
|
|
778
|
-
z.object({
|
|
779
|
-
id: z.string()
|
|
780
|
-
});
|
|
781
|
-
var DeleteBankAccountInputSchema = z.object({
|
|
782
|
-
id: z.number()
|
|
783
|
-
});
|
|
784
|
-
var GetSendQuoteInputSchema = z.object({
|
|
785
|
-
id: z.string(),
|
|
786
|
-
usdAmount: z.string()
|
|
787
|
-
});
|
|
788
|
-
var SendFundsInputSchema = z.object({
|
|
789
|
-
id: z.string(),
|
|
790
|
-
userAddress: z.string(),
|
|
791
|
-
quoteResponse: QuoteResponseSchema
|
|
792
|
-
});
|
|
793
|
-
z.object({
|
|
794
|
-
id: z.string()
|
|
795
|
-
});
|
|
796
|
-
var UpdateTransferInputSchema = z.object({
|
|
797
|
-
id: z.string(),
|
|
798
|
-
solanaSignature: z.string()
|
|
799
|
-
});
|
|
800
|
-
var KycStatusOutputSchema = z.object({
|
|
801
|
-
kycStatus: z.string(),
|
|
802
|
-
tosStatus: z.string(),
|
|
803
|
-
tosLink: z.string().nullable(),
|
|
804
|
-
kycLink: z.string().nullable(),
|
|
805
|
-
kycLinkId: z.string().nullable(),
|
|
806
|
-
accountType: z.string().optional(),
|
|
807
|
-
rejectionReasons: z.array(z.string()).optional()
|
|
808
|
-
});
|
|
809
|
-
var FeesOutputSchema = z.object({
|
|
810
|
-
developer_fee: z.string(),
|
|
811
|
-
developer_fee_percent: z.number()
|
|
812
|
-
});
|
|
813
|
-
var BankAccountSchema = z.object({
|
|
814
|
-
id: z.number().optional(),
|
|
815
|
-
bridgeUserId: z.number().optional(),
|
|
816
|
-
bridgeExternalAccountId: z.string().optional(),
|
|
817
|
-
accountName: z.string().optional(),
|
|
818
|
-
bankName: z.string().optional(),
|
|
819
|
-
lastFourDigits: z.string().optional(),
|
|
820
|
-
routingNumber: z.string().optional(),
|
|
821
|
-
accountType: z.string().optional(),
|
|
822
|
-
createdAt: z.union([z.string(), z.date()]).optional(),
|
|
823
|
-
updatedAt: z.union([z.string(), z.date()]).optional()
|
|
824
|
-
}).passthrough();
|
|
825
|
-
var BankAccountListOutputSchema = z.array(BankAccountSchema);
|
|
826
|
-
var DeleteBankAccountOutputSchema = z.object({
|
|
827
|
-
success: z.boolean()
|
|
828
|
-
});
|
|
829
|
-
var BridgeTransferSchema = z.object({
|
|
830
|
-
id: z.string(),
|
|
831
|
-
state: z.string(),
|
|
832
|
-
source_deposit_instructions: z.object({
|
|
833
|
-
to_address: z.string()
|
|
834
|
-
})
|
|
835
|
-
}).passthrough();
|
|
836
|
-
var SendFundsOutputSchema = z.object({
|
|
837
|
-
bridgeTransfer: BridgeTransferSchema,
|
|
838
|
-
transactionData: TransactionDataSchema
|
|
839
|
-
});
|
|
840
|
-
var UpdateTransferOutputSchema = z.object({
|
|
841
|
-
success: z.boolean()
|
|
842
|
-
});
|
|
843
|
-
var QuoteOutputSchema = QuoteResponseSchema;
|
|
844
1102
|
var fiatContract = oc.errors({
|
|
845
1103
|
UNAUTHENTICATED,
|
|
846
1104
|
UNAUTHORIZED
|
|
@@ -900,6 +1158,7 @@ var apiContract = oc.router({
|
|
|
900
1158
|
health: healthContract,
|
|
901
1159
|
tokens: tokensContract,
|
|
902
1160
|
hotspots: hotspotsContract,
|
|
1161
|
+
rewardContract,
|
|
903
1162
|
swap: swapContract,
|
|
904
1163
|
transactions: transactionsContract,
|
|
905
1164
|
welcomePacks: welcomePacksContract
|
|
@@ -910,4 +1169,4 @@ var fullApiContract = oc.router({
|
|
|
910
1169
|
webhooks: webhooksContract
|
|
911
1170
|
});
|
|
912
1171
|
|
|
913
|
-
export { AutomationScheduleSchema, AutomationStatusOutputSchema, BAD_REQUEST, BatchStatusOutputSchema, CONFLICT, ClaimRewardsInputSchema, ClaimRewardsOutputSchema, CloseAutomationInputSchema, CloseAutomationOutputSchema, CreateHntAccountInputSchema, CreateHntAccountOutputSchema, CreateSplitInputSchema, CreateSplitOutputSchema, DeleteSplitInputSchema, DeleteSplitOutputSchema, DeviceTypeSchema, ErrorResponseSchema, FundAutomationInputSchema, FundAutomationOutputSchema, FundingEstimateOutputSchema, GetAutomationStatusInputSchema, GetBalancesInputSchema, GetByPayerAndTagInputSchema, GetByPayerInputSchema, GetFundingEstimateInputSchema, GetHotspotsInputSchema, GetInputSchema, GetInstructionsInputSchema, GetPendingRewardsInputSchema, GetQuoteInputSchema, GetSplitInputSchema, GetTokensInputSchema, HealthResponseSchema, HeliumPublicKeySchema, HotspotSchema, HotspotSharesSchema, HotspotTypeSchema, HotspotsDataSchema, INSUFFICIENT_FUNDS, INVALID_WALLET_ADDRESS, NOT_FOUND, OwnershipTypeSchema, PaginationInputSchema, PaginationOutputSchema, PayerBatchSummarySchema, PayerBatchesOutputSchema,
|
|
1172
|
+
export { AutomationScheduleSchema, AutomationStatusOutputSchema, BAD_REQUEST, BankAccountListOutputSchema, BankAccountSchema, BatchStatusOutputSchema, BridgeTransferSchema, CONFLICT, ClaimInviteRequestSchema, ClaimInviteResponseSchema, ClaimRewardsInputSchema, ClaimRewardsOutputSchema, CloseAutomationInputSchema, CloseAutomationOutputSchema, CreateBankAccountInputSchema, CreateHntAccountInputSchema, CreateHntAccountOutputSchema, CreateInviteResponseSchema, CreateRewardContractTransactionInputSchema, CreateRewardContractTransactionResponseSchema, CreateSplitInputSchema, CreateSplitOutputSchema, DeleteBankAccountInputSchema, DeleteBankAccountOutputSchema, DeleteRewardContractTransactionResponseSchema, DeleteSplitInputSchema, DeleteSplitOutputSchema, DeviceTypeSchema, ErrorResponseSchema, FeesOutputSchema, FindRewardContractResponseSchema, FundAutomationInputSchema, FundAutomationOutputSchema, FundingEstimateOutputSchema, GetAutomationStatusInputSchema, GetBalancesInputSchema, GetBankAccountInputSchema, GetByPayerAndTagInputSchema, GetByPayerInputSchema, GetFundingEstimateInputSchema, GetHotspotsInputSchema, GetInputSchema, GetInstructionsInputSchema, GetPendingRewardsInputSchema, GetPendingRewardsOutputSchema, GetQuoteInputSchema, GetSendQuoteInputSchema, GetSplitInputSchema, GetTokensInputSchema, GetTransferInputSchema, HealthResponseSchema, HeliumPublicKeySchema, HotspotSchema, HotspotSharesSchema, HotspotTypeSchema, HotspotsDataSchema, INSUFFICIENT_FUNDS, INVALID_WALLET_ADDRESS, InitKycInputSchema, KycStatusOutputSchema, NOT_FOUND, OwnershipTypeSchema, PaginationInputSchema, PaginationOutputSchema, PayerBatchSummarySchema, PayerBatchesOutputSchema, PublicKeySchema, QuoteOutputSchema, QuoteResponseSchema, RATE_LIMITED, ResubmitInputSchema, ResubmitOutputSchema, RewardSplitInputSchema, SIMULATION_FAILED, ScheduleInputSchema, SendFundsInputSchema, SendFundsOutputSchema, SetupAutomationInputSchema, SetupAutomationOutputSchema, SplitResponseSchema, SplitShareSchema, SubmitInputSchema, SubmitOutputSchema, SwapTransactionDataSchema, TRANSACTION_FAILED, TokenAccountSchema, TokenAmountInputSchema, TokenAmountOutputSchema, TokenBalanceDataSchema, TokenListOutputSchema, TokenSchema, TransactionBatchRequestSchema, TransactionBatchResponseSchema, TransactionDataSchema, TransactionItemSchema, TransactionMetadataSchema, TransactionStatusSchema, TransferHotspotInputSchema, TransferHotspotOutputSchema, TransferInputSchema, TransferOutputSchema, UNAUTHENTICATED, UNAUTHORIZED, UpdateHotspotInfoInputSchema, UpdateHotspotInfoOutputSchema, UpdateRewardsDestinationInputSchema, UpdateRewardsDestinationOutputSchema, UpdateTransferInputSchema, UpdateTransferOutputSchema, WalletAddressSchema, WelcomePackClaimInputSchema, WelcomePackClaimOutputSchema, WelcomePackCreateInputSchema, WelcomePackCreateOutputSchema, WelcomePackDeleteInputSchema, WelcomePackDeleteOutputSchema, WelcomePackGetByAddressInputSchema, WelcomePackGetInputSchema, WelcomePackInviteInputSchema, WelcomePackInviteOutputSchema, WelcomePackListInputSchema, WelcomePackListOutputSchema, WelcomePackSchema, apiContract, fullApiContract };
|