dogecoin-core-trpc-api 0.0.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/LICENSE +21 -0
- package/README.md +241 -0
- package/dist/chunk-GZ3OT3YJ.js +45 -0
- package/dist/chunk-OP2QDE6K.js +4 -0
- package/dist/chunk-Z4KAWBXZ.js +22 -0
- package/dist/client/index.cjs +6 -0
- package/dist/client/index.d.cts +333 -0
- package/dist/client/index.d.ts +333 -0
- package/dist/client/index.js +6 -0
- package/dist/index.cjs +67 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/server/index.cjs +48 -0
- package/dist/server/index.d.cts +325 -0
- package/dist/server/index.d.ts +325 -0
- package/dist/server/index.js +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import * as _trpc_client from '@trpc/client';
|
|
2
|
+
import { httpBatchLink } from '@trpc/client';
|
|
3
|
+
import * as _trpc_server from '@trpc/server';
|
|
4
|
+
export { AppRouter } from '../server/index.js';
|
|
5
|
+
|
|
6
|
+
type HttpBatchLinkOptions = Parameters<typeof httpBatchLink>[0];
|
|
7
|
+
declare const DEFAULT_TRPC_URL = "https://rpc.dogeapi.io";
|
|
8
|
+
type DogecoinCoreClientOptions = Omit<HttpBatchLinkOptions, "transformer" | "url"> & {
|
|
9
|
+
url?: HttpBatchLinkOptions["url"];
|
|
10
|
+
};
|
|
11
|
+
declare function createDogecoinCoreClient(options?: DogecoinCoreClientOptions): _trpc_client.TRPCClient<_trpc_server.TRPCBuiltRouter<{
|
|
12
|
+
ctx: object;
|
|
13
|
+
meta: object;
|
|
14
|
+
errorShape: {
|
|
15
|
+
data: {
|
|
16
|
+
zodError: {
|
|
17
|
+
errors: string[];
|
|
18
|
+
} | null;
|
|
19
|
+
code: _trpc_server.TRPC_ERROR_CODE_KEY;
|
|
20
|
+
httpStatus: number;
|
|
21
|
+
path?: string;
|
|
22
|
+
stack?: string;
|
|
23
|
+
};
|
|
24
|
+
message: string;
|
|
25
|
+
code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
|
|
26
|
+
};
|
|
27
|
+
transformer: true;
|
|
28
|
+
}, _trpc_server.TRPCDecorateCreateRouterOptions<{
|
|
29
|
+
estimateSmartFee: _trpc_server.TRPCQueryProcedure<{
|
|
30
|
+
input: {
|
|
31
|
+
requestId: string | null;
|
|
32
|
+
nblocks: number;
|
|
33
|
+
};
|
|
34
|
+
output: {
|
|
35
|
+
id: string | null;
|
|
36
|
+
error: {
|
|
37
|
+
message: string;
|
|
38
|
+
} | null;
|
|
39
|
+
result: {
|
|
40
|
+
feerate: number;
|
|
41
|
+
blocks: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
meta: object;
|
|
45
|
+
}>;
|
|
46
|
+
getNetworkInfo: _trpc_server.TRPCQueryProcedure<{
|
|
47
|
+
input: {
|
|
48
|
+
requestId: string | null;
|
|
49
|
+
};
|
|
50
|
+
output: {
|
|
51
|
+
id: string | null;
|
|
52
|
+
error: {
|
|
53
|
+
message: string;
|
|
54
|
+
} | null;
|
|
55
|
+
result: {
|
|
56
|
+
version: number;
|
|
57
|
+
subversion: string;
|
|
58
|
+
protocolversion: number;
|
|
59
|
+
localservices: string;
|
|
60
|
+
localrelay: boolean;
|
|
61
|
+
timeoffset: number;
|
|
62
|
+
networkactive: boolean;
|
|
63
|
+
connections: number;
|
|
64
|
+
networks: {
|
|
65
|
+
name: string;
|
|
66
|
+
limited: boolean;
|
|
67
|
+
reachable: boolean;
|
|
68
|
+
proxy: string;
|
|
69
|
+
proxy_randomize_credentials: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
relayfee: number;
|
|
72
|
+
incrementalfee: number;
|
|
73
|
+
softdustlimit: number;
|
|
74
|
+
harddustlimit: number;
|
|
75
|
+
localaddresses: {
|
|
76
|
+
address: string;
|
|
77
|
+
port: number;
|
|
78
|
+
score: number;
|
|
79
|
+
}[];
|
|
80
|
+
warnings?: string | undefined;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
meta: object;
|
|
84
|
+
}>;
|
|
85
|
+
getRawTransaction: _trpc_server.TRPCQueryProcedure<{
|
|
86
|
+
input: {
|
|
87
|
+
requestId: string | null;
|
|
88
|
+
txid: string;
|
|
89
|
+
verbose?: boolean | undefined;
|
|
90
|
+
blockhash?: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
output: {
|
|
93
|
+
id: string | null;
|
|
94
|
+
error: {
|
|
95
|
+
message: string;
|
|
96
|
+
} | null;
|
|
97
|
+
result: string | {
|
|
98
|
+
hex: string;
|
|
99
|
+
txid: string;
|
|
100
|
+
hash: string;
|
|
101
|
+
size: number;
|
|
102
|
+
vsize: number;
|
|
103
|
+
version: number;
|
|
104
|
+
locktime: number;
|
|
105
|
+
vin: {
|
|
106
|
+
txid?: string | undefined;
|
|
107
|
+
vout?: number | undefined;
|
|
108
|
+
scriptSig?: {
|
|
109
|
+
asm: string;
|
|
110
|
+
hex: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
sequence?: number | undefined;
|
|
113
|
+
}[];
|
|
114
|
+
vout: {
|
|
115
|
+
value: number;
|
|
116
|
+
n: number;
|
|
117
|
+
scriptPubKey: {
|
|
118
|
+
asm: string;
|
|
119
|
+
hex: string;
|
|
120
|
+
type: string;
|
|
121
|
+
addresses: string[];
|
|
122
|
+
reqSigs?: number | undefined;
|
|
123
|
+
};
|
|
124
|
+
}[];
|
|
125
|
+
blockhash?: string | undefined;
|
|
126
|
+
confirmations?: number | undefined;
|
|
127
|
+
time?: number | undefined;
|
|
128
|
+
blocktime?: number | undefined;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
meta: object;
|
|
132
|
+
}>;
|
|
133
|
+
getBlockHash: _trpc_server.TRPCQueryProcedure<{
|
|
134
|
+
input: {
|
|
135
|
+
requestId: string | null;
|
|
136
|
+
height: number;
|
|
137
|
+
};
|
|
138
|
+
output: {
|
|
139
|
+
id: string | null;
|
|
140
|
+
error: {
|
|
141
|
+
message: string;
|
|
142
|
+
} | null;
|
|
143
|
+
result: string;
|
|
144
|
+
};
|
|
145
|
+
meta: object;
|
|
146
|
+
}>;
|
|
147
|
+
getBlock: _trpc_server.TRPCQueryProcedure<{
|
|
148
|
+
input: {
|
|
149
|
+
requestId: string | null;
|
|
150
|
+
blockhash: string;
|
|
151
|
+
verbosity?: number | undefined;
|
|
152
|
+
};
|
|
153
|
+
output: {
|
|
154
|
+
id: string | null;
|
|
155
|
+
error: {
|
|
156
|
+
message: string;
|
|
157
|
+
} | null;
|
|
158
|
+
result: string | {
|
|
159
|
+
hash: string;
|
|
160
|
+
confirmations: number;
|
|
161
|
+
size: number;
|
|
162
|
+
height: number;
|
|
163
|
+
version: number;
|
|
164
|
+
merkleroot: string;
|
|
165
|
+
tx: unknown[];
|
|
166
|
+
time: number;
|
|
167
|
+
nonce: number;
|
|
168
|
+
bits: string;
|
|
169
|
+
difficulty: number;
|
|
170
|
+
strippedsize?: number | undefined;
|
|
171
|
+
weight?: number | undefined;
|
|
172
|
+
versionHex?: string | undefined;
|
|
173
|
+
mediantime?: number | undefined;
|
|
174
|
+
chainwork?: string | undefined;
|
|
175
|
+
nTx?: number | undefined;
|
|
176
|
+
previousblockhash?: string | undefined;
|
|
177
|
+
nextblockhash?: string | undefined;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
meta: object;
|
|
181
|
+
}>;
|
|
182
|
+
getRawMempool: _trpc_server.TRPCQueryProcedure<{
|
|
183
|
+
input: {
|
|
184
|
+
requestId: string | null;
|
|
185
|
+
verbose?: boolean | undefined;
|
|
186
|
+
mempool_sequence?: boolean | undefined;
|
|
187
|
+
};
|
|
188
|
+
output: {
|
|
189
|
+
id: string | null;
|
|
190
|
+
error: {
|
|
191
|
+
message: string;
|
|
192
|
+
} | null;
|
|
193
|
+
result: string[] | Record<string, {
|
|
194
|
+
vsize: number;
|
|
195
|
+
time: number;
|
|
196
|
+
height: number;
|
|
197
|
+
descendantcount: number;
|
|
198
|
+
descendantsize: number;
|
|
199
|
+
ancestorcount: number;
|
|
200
|
+
ancestorsize: number;
|
|
201
|
+
depends: string[];
|
|
202
|
+
weight?: number | undefined;
|
|
203
|
+
fee?: number | undefined;
|
|
204
|
+
modifiedfee?: number | undefined;
|
|
205
|
+
descendantfees?: number | undefined;
|
|
206
|
+
ancestorfees?: number | undefined;
|
|
207
|
+
wtxid?: string | undefined;
|
|
208
|
+
fees?: {
|
|
209
|
+
base: number;
|
|
210
|
+
modified: number;
|
|
211
|
+
ancestor: number;
|
|
212
|
+
descendant: number;
|
|
213
|
+
} | undefined;
|
|
214
|
+
spentby?: string[] | undefined;
|
|
215
|
+
"bip125-replaceable"?: boolean | undefined;
|
|
216
|
+
unbroadcast?: boolean | undefined;
|
|
217
|
+
}> | {
|
|
218
|
+
txids: string[];
|
|
219
|
+
mempool_sequence: number;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
meta: object;
|
|
223
|
+
}>;
|
|
224
|
+
getMempoolInfo: _trpc_server.TRPCQueryProcedure<{
|
|
225
|
+
input: {
|
|
226
|
+
requestId: string | null;
|
|
227
|
+
};
|
|
228
|
+
output: {
|
|
229
|
+
id: string | null;
|
|
230
|
+
error: {
|
|
231
|
+
message: string;
|
|
232
|
+
} | null;
|
|
233
|
+
result: {
|
|
234
|
+
size: number;
|
|
235
|
+
bytes: number;
|
|
236
|
+
usage: number;
|
|
237
|
+
loaded?: boolean | undefined;
|
|
238
|
+
maxmempool?: number | undefined;
|
|
239
|
+
mempoolminfee?: number | undefined;
|
|
240
|
+
minrelaytxfee?: number | undefined;
|
|
241
|
+
unbroadcastcount?: number | undefined;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
meta: object;
|
|
245
|
+
}>;
|
|
246
|
+
getBestBlockHash: _trpc_server.TRPCQueryProcedure<{
|
|
247
|
+
input: {
|
|
248
|
+
requestId: string | null;
|
|
249
|
+
};
|
|
250
|
+
output: {
|
|
251
|
+
id: string | null;
|
|
252
|
+
error: {
|
|
253
|
+
message: string;
|
|
254
|
+
} | null;
|
|
255
|
+
result: string;
|
|
256
|
+
};
|
|
257
|
+
meta: object;
|
|
258
|
+
}>;
|
|
259
|
+
getBlockCount: _trpc_server.TRPCQueryProcedure<{
|
|
260
|
+
input: {
|
|
261
|
+
requestId: string | null;
|
|
262
|
+
};
|
|
263
|
+
output: {
|
|
264
|
+
id: string | null;
|
|
265
|
+
error: {
|
|
266
|
+
message: string;
|
|
267
|
+
} | null;
|
|
268
|
+
result: number;
|
|
269
|
+
};
|
|
270
|
+
meta: object;
|
|
271
|
+
}>;
|
|
272
|
+
validateAddress: _trpc_server.TRPCQueryProcedure<{
|
|
273
|
+
input: {
|
|
274
|
+
requestId: string | null;
|
|
275
|
+
address: string;
|
|
276
|
+
};
|
|
277
|
+
output: {
|
|
278
|
+
id: string | null;
|
|
279
|
+
error: {
|
|
280
|
+
message: string;
|
|
281
|
+
} | null;
|
|
282
|
+
result: {
|
|
283
|
+
isvalid: boolean;
|
|
284
|
+
address?: string | undefined;
|
|
285
|
+
scriptPubKey?: string | undefined;
|
|
286
|
+
isscript?: boolean | undefined;
|
|
287
|
+
iswitness?: boolean | undefined;
|
|
288
|
+
witness_version?: number | undefined;
|
|
289
|
+
witness_program?: string | undefined;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
meta: object;
|
|
293
|
+
}>;
|
|
294
|
+
ping: _trpc_server.TRPCQueryProcedure<{
|
|
295
|
+
input: {
|
|
296
|
+
requestId: string | null;
|
|
297
|
+
};
|
|
298
|
+
output: {
|
|
299
|
+
id: string | null;
|
|
300
|
+
error: {
|
|
301
|
+
message: string;
|
|
302
|
+
} | null;
|
|
303
|
+
result: null;
|
|
304
|
+
};
|
|
305
|
+
meta: object;
|
|
306
|
+
}>;
|
|
307
|
+
sendRawTransaction: _trpc_server.TRPCMutationProcedure<{
|
|
308
|
+
input: {
|
|
309
|
+
requestId: string | null;
|
|
310
|
+
hexstring: string;
|
|
311
|
+
maxfeerate?: string | number | undefined;
|
|
312
|
+
};
|
|
313
|
+
output: {
|
|
314
|
+
id: string | null;
|
|
315
|
+
error: {
|
|
316
|
+
message: string;
|
|
317
|
+
} | null;
|
|
318
|
+
result: string;
|
|
319
|
+
};
|
|
320
|
+
meta: object;
|
|
321
|
+
}>;
|
|
322
|
+
health: _trpc_server.TRPCQueryProcedure<{
|
|
323
|
+
input: void;
|
|
324
|
+
output: {
|
|
325
|
+
status: string;
|
|
326
|
+
message: string;
|
|
327
|
+
};
|
|
328
|
+
meta: object;
|
|
329
|
+
}>;
|
|
330
|
+
}>>>;
|
|
331
|
+
type DogecoinCoreClient = ReturnType<typeof createDogecoinCoreClient>;
|
|
332
|
+
|
|
333
|
+
export { DEFAULT_TRPC_URL, type DogecoinCoreClient, type DogecoinCoreClientOptions, createDogecoinCoreClient };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as w,b as N}from"../chunk-Z4KAWBXZ.js";import{b as k,k as I,l as D,t as B,x as $}from"../chunk-OP2QDE6K.js";var le=Object.create,Y=Object.defineProperty,de=Object.getOwnPropertyDescriptor,K=Object.getOwnPropertyNames,pe=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,x=(t,e)=>function(){return e||(0,t[K(t)[0]])((e={exports:{}}).exports,e),e.exports},me=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=K(e),i=0,u=n.length,s;i<u;i++)s=n[i],!fe.call(t,s)&&s!==r&&Y(t,s,{get:(a=>e[a]).bind(null,s),enumerable:!(o=de(e,s))||o.enumerable});return t},h=(t,e,r)=>(r=t!=null?le(pe(t)):{},me(e||!t||!t.__esModule?Y(r,"default",{value:t,enumerable:!0}):r,t)),V=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(o){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,r(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),he=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=V().default;function o(n,i){if(r(n)!="object"||!n)return n;var u=n[Symbol.toPrimitive];if(u!==void 0){var s=u.call(n,i||"default");if(r(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),ye=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=V().default,o=he();function n(i){var u=o(i,"string");return r(u)=="symbol"?u:u+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),P=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=ye();function o(n,i,u){return(i=r(i))in n?Object.defineProperty(n,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[i]=u,n}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),v=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=P();function o(i,u){var s=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);u&&(a=a.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),s.push.apply(s,a)}return s}function n(i){for(var u=1;u<arguments.length;u++){var s=arguments[u]!=null?arguments[u]:{};u%2?o(Object(s),!0).forEach(function(a){r(i,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(s)):o(Object(s)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(s,a))})}return i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});function U(t){return e=>{let r=0,o=null,n=[];function i(){o||(o=e.subscribe({next(s){for(let c of n){var a;(a=c.next)===null||a===void 0||a.call(c,s)}},error(s){for(let c of n){var a;(a=c.error)===null||a===void 0||a.call(c,s)}},complete(){for(let a of n){var s;(s=a.complete)===null||s===void 0||s.call(a)}}}))}function u(){if(r===0&&o){let s=o;o=null,s.unsubscribe()}}return w(s=>(r++,n.push(s),i(),{unsubscribe(){r--,u();let a=n.findIndex(c=>c===s);a>-1&&n.splice(a,1)}}))}}function j(t){let e=t,r=[],o=u=>{e!==void 0&&u.next(e),r.push(u)},n=u=>{r.splice(r.indexOf(u),1)},i=w(u=>(o(u),()=>{n(u)}));return i.next=u=>{if(e!==u){e=u;for(let s of r)s.next(u)}},i.get=()=>e,i}function Q(t){return w(e=>{function r(n=0,i=t.op){let u=t.links[n];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:i,next(a){return r(n+1,a)}})}return r().subscribe(e)})}var E=h(P(),1),O=h(v(),1);function X(t){return t instanceof S}function we(t){return k(t)&&k(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function Pe(t,e){return typeof t=="string"?t:k(t)&&typeof t.message=="string"?t.message:e}var S=class q extends Error{constructor(e,r){var o,n;let i=r?.cause;super(e,{cause:i}),(0,E.default)(this,"cause",void 0),(0,E.default)(this,"shape",void 0),(0,E.default)(this,"data",void 0),(0,E.default)(this,"meta",void 0),this.meta=r?.meta,this.cause=i,this.shape=r==null||(o=r.result)===null||o===void 0?void 0:o.error,this.data=r==null||(n=r.result)===null||n===void 0?void 0:n.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,q.prototype)}static from(e,r={}){let o=e;return X(o)?(r.meta&&(o.meta=(0,O.default)((0,O.default)({},o.meta),r.meta)),o):we(o)?new q(o.error.message,(0,O.default)((0,O.default)({},r),{},{result:o})):new q(Pe(o,"Unknown error"),(0,O.default)((0,O.default)({},r),{},{cause:o}))}};function M(t){let e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}var Z=t=>typeof t=="function";function ee(t){if(t)return t;if(typeof window<"u"&&Z(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Z(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var C=h(v(),1);function L(t){return{url:t.url.toString(),fetch:t.fetch,transformer:M(t.transformer),methodOverride:t.methodOverride}}function Se(t){let e={};for(let r=0;r<t.length;r++){let o=t[r];e[r]=o}return e}var _e={query:"GET",mutation:"POST",subscription:"PATCH"};function te(t){return"input"in t?t.transformer.input.serialize(t.input):Se(t.inputs.map(e=>t.transformer.input.serialize(e)))}var T=t=>{let e=t.url.split("?"),o=e[0].replace(/\/$/,"")+"/"+t.path,n=[];if(e[1]&&n.push(e[1]),"inputs"in t&&n.push("batch=1"),t.type==="query"||t.type==="subscription"){let i=te(t);i!==void 0&&t.methodOverride!=="POST"&&n.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return n.length&&(o+="?"+n.join("&")),o},re=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;let e=te(t);return e!==void 0?JSON.stringify(e):void 0},W=t=>oe((0,C.default)((0,C.default)({},t),{},{contentTypeHeader:"application/json",getUrl:T,getBody:re})),Oe=class extends Error{constructor(){let t="AbortError";super(t),this.name=t,this.message=t}},ke=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Oe};async function ne(t){var e;ke(t.signal);let r=t.getUrl(t),o=t.getBody(t),n=(e=t.methodOverride)!==null&&e!==void 0?e:_e[t.type],i=await(async()=>{let s=await t.headers();return Symbol.iterator in s?Object.fromEntries(s):s})(),u=(0,C.default)((0,C.default)((0,C.default)({},t.contentTypeHeader&&n!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),i);return ee(t.fetch)(r,{method:n,signal:t.signal,body:o,headers:u})}async function oe(t){let e={},r=await ne(t);e.response=r;let o=await r.json();return e.responseJSON=o,{json:o,meta:e}}var Vt=h(v(),1);var ie=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function F(t){let e=null,r=null,o=()=>{clearTimeout(r),r=null,e=null};function n(s){let a=[[]],c=0;for(;;){let f=s[c];if(!f)break;let p=a[a.length-1];if(f.aborted){var m;(m=f.reject)===null||m===void 0||m.call(f,new Error("Aborted")),c++;continue}if(t.validate(p.concat(f).map(d=>d.key))){p.push(f),c++;continue}if(p.length===0){var l;(l=f.reject)===null||l===void 0||l.call(f,new Error("Input is too big for a single dispatch")),c++;continue}a.push([])}return a}function i(){let s=n(e);o();for(let a of s){if(!a.length)continue;let c={items:a};for(let l of a)l.batch=c;t.fetch(c.items.map(l=>l.key)).then(async l=>{await Promise.all(l.map(async(p,y)=>{let d=c.items[y];try{var b;let g=await Promise.resolve(p);(b=d.resolve)===null||b===void 0||b.call(d,g)}catch(g){var R;(R=d.reject)===null||R===void 0||R.call(d,g)}d.batch=null,d.reject=null,d.resolve=null}));for(let p of c.items){var f;(f=p.reject)===null||f===void 0||f.call(p,new Error("Missing result")),p.batch=null}}).catch(l=>{for(let p of c.items){var f;(f=p.reject)===null||f===void 0||f.call(p,l),p.batch=null}})}}function u(s){var a;let c={aborted:!1,key:s,batch:null,resolve:ie,reject:ie},m=new Promise((l,f)=>{var p;c.reject=f,c.resolve=l,(p=e)!==null&&p!==void 0||(e=[]),e.push(c)});return(a=r)!==null&&a!==void 0||(r=setTimeout(i)),m}return{load:u}}function se(...t){let e=new AbortController,r=t.length,o=0,n=()=>{++o===r&&e.abort()};for(let i of t)i?.aborted?n():i?.addEventListener("abort",n,{once:!0});return e.signal}var A=h(v(),1);function z(t){var e,r;let o=L(t),n=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,i=(r=t.maxItems)!==null&&r!==void 0?r:1/0;return()=>{let u=m=>({validate(l){if(n===1/0&&i===1/0)return!0;if(l.length>i)return!1;let f=l.map(d=>d.path).join(","),p=l.map(d=>d.input);return T((0,A.default)((0,A.default)({},o),{},{type:m,path:f,inputs:p,signal:null})).length<=n},async fetch(l){let f=l.map(g=>g.path).join(","),p=l.map(g=>g.input),y=se(...l.map(g=>g.signal)),d=await W((0,A.default)((0,A.default)({},o),{},{path:f,inputs:p,type:m,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:l}):t.headers:{}},signal:y}));return(Array.isArray(d.json)?d.json:l.map(()=>d.json)).map(g=>({meta:d.meta,json:g}))}}),s=F(u("query")),a=F(u("mutation")),c={query:s,mutation:a};return({op:m})=>w(l=>{if(m.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let p=c[m.type].load(m),y;return p.then(d=>{y=d;let b=B(d.json,o.transformer.output);if(!b.ok){l.error(S.from(b.error,{meta:d.meta}));return}l.next({context:d.meta,result:b.result}),l.complete()}).catch(d=>{l.error(S.from(d,{meta:y?.meta}))}),()=>{}})}}var ir=h(v(),1);var G=(t,...e)=>typeof t=="function"?t(...e):t,dr=h(P(),1);function Ce(){let t,e;return{promise:new Promise((o,n)=>{t=o,e=n}),resolve:t,reject:e}}async function Te(t){let e=await G(t.url);if(!t.connectionParams)return e;let o=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+o}async function Re(t){let e={method:"connectionParams",data:await G(t)};return JSON.stringify(e)}var pr=h(P(),1);var _=h(P(),1);function je(t){let{promise:e,resolve:r,reject:o}=Ce();return t.addEventListener("open",()=>{t.removeEventListener("error",o),r()}),t.addEventListener("error",o),e}function Ee(t,{intervalMs:e,pongTimeoutMs:r}){let o,n;function i(){o=setTimeout(()=>{t.send("PING"),n=setTimeout(()=>{t.close()},r)},e)}function u(){clearTimeout(o),i()}function s(){clearTimeout(n),u()}t.addEventListener("open",i),t.addEventListener("message",({data:a})=>{clearTimeout(o),i(),a==="PONG"&&s()}),t.addEventListener("close",()=>{clearTimeout(o),clearTimeout(n)})}var qe=class H{constructor(e){var r;if((0,_.default)(this,"id",++H.connectCount),(0,_.default)(this,"WebSocketPonyfill",void 0),(0,_.default)(this,"urlOptions",void 0),(0,_.default)(this,"keepAliveOpts",void 0),(0,_.default)(this,"wsObservable",j(null)),(0,_.default)(this,"openPromise",null),this.WebSocketPonyfill=(r=e.WebSocketPonyfill)!==null&&r!==void 0?r:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++H.connectCount;let r=Te(e.urlOptions).then(o=>new e.WebSocketPonyfill(o));e.openPromise=r.then(async o=>{e.ws=o,o.addEventListener("message",function({data:n}){n==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&Ee(o,e.keepAliveOpts),o.addEventListener("close",()=>{e.ws===o&&(e.ws=null)}),await je(o),e.urlOptions.connectionParams&&o.send(await Re(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var r;(r=e.ws)===null||r===void 0||r.close()}}};(0,_.default)(qe,"connectCount",0);var fr=h(P(),1),mr=h(v(),1);var J=h(P(),1),ae=h(v(),1),Me=class{constructor(t){(0,J.default)(this,"links",void 0),(0,J.default)(this,"runtime",void 0),(0,J.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return Q({links:this.links,op:(0,ae.default)((0,ae.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(U())}async requestAsPromise(t){var e=this;try{let r=e.$request(t);return(await N(r)).result.data}catch(r){throw S.from(r)}}query(t,e,r){return this.requestAsPromise({type:"query",path:t,input:e,context:r?.context,signal:r?.signal})}mutation(t,e,r){return this.requestAsPromise({type:"mutation",path:t,input:e,context:r?.context,signal:r?.signal})}subscription(t,e,r){return this.$request({type:"subscription",path:t,input:e,context:r.context,signal:r.signal}).subscribe({next(n){switch(n.result.type){case"state":{var i;(i=r.onConnectionStateChange)===null||i===void 0||i.call(r,n.result);break}case"started":{var u;(u=r.onStarted)===null||u===void 0||u.call(r,{context:n.context});break}case"stopped":{var s;(s=r.onStopped)===null||s===void 0||s.call(r);break}case"data":case void 0:{var a;(a=r.onData)===null||a===void 0||a.call(r,n.result.data);break}}},error(n){var i;(i=r.onError)===null||i===void 0||i.call(r,n)},complete(){var n;(n=r.onComplete)===null||n===void 0||n.call(r)}})}};var Le=Symbol.for("trpc_untypedClient"),Ae={query:"query",mutate:"mutation",subscribe:"subscription"},Ie=t=>Ae[t];function De(t){let e=I(({path:r,args:o})=>{let n=[...r],i=Ie(n.pop()),u=n.join(".");return t[i](u,...o)});return D(r=>r===Le?t:e[r])}function ue(t){let e=new Me(t);return De(e)}var Fr=h(v(),1);var zr=h(v(),1);var Be=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(n){var i,u,s,a=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,s=Symbol.iterator);a--;){if(u&&(i=n[u])!=null)return i.call(n);if(s&&(i=n[s])!=null)return new o(i.call(n));u="@@asyncIterator",s="@@iterator"}throw new TypeError("Object is not async iterable")}function o(n){function i(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var s=u.done;return Promise.resolve(u.value).then(function(a){return{value:a,done:s}})}return o=function(s){this.s=s,this.n=s.next},o.prototype={s:null,n:null,next:function(){return i(this.n.apply(this.s,arguments))},return:function(s){var a=this.s.return;return a===void 0?Promise.resolve({value:s,done:!0}):i(a.apply(this.s,arguments))},throw:function(s){var a=this.s.return;return a===void 0?Promise.reject(s):i(a.apply(this.s,arguments))}},new o(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Hr=h(Be(),1);var Gr=h(v(),1);var Ne=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var o=typeof SuppressedError=="function"?SuppressedError:function(s,a){var c=Error();return c.name="SuppressedError",c.error=s,c.suppressed=a,c},n={},i=[];function u(s,a){if(a!=null){if(Object(a)!==a)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(s)var c=a[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(c===void 0&&(c=a[Symbol.dispose||Symbol.for("Symbol.dispose")],s))var m=c;if(typeof c!="function")throw new TypeError("Object is not disposable.");m&&(c=function(){try{m.call(a)}catch(f){return Promise.reject(f)}}),i.push({v:a,d:c,a:s})}else s&&i.push({d:a,a:s});return a}return{e:n,u:u.bind(null,!1),a:u.bind(null,!0),d:function(){var a,c=this.e,m=0;function l(){for(;a=i.pop();)try{if(!a.a&&m===1)return m=0,i.push(a),Promise.resolve().then(l);if(a.d){var p=a.d.call(a.v);if(a.a)return m|=2,Promise.resolve(p).then(l,f)}else m|=1}catch(y){return f(y)}if(m===1)return c!==n?Promise.reject(c):Promise.resolve();if(c!==n)throw c}function f(p){return c=c!==n?new o(p,c):p,l()}return l()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ce=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(o,n){this.v=o,this.k=n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ue=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=ce();function o(n){return new r(n,0)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),We=x({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=ce();function o(i){return function(){return new n(i.apply(this,arguments))}}function n(i){var u,s;function a(m,l){try{var f=i[m](l),p=f.value,y=p instanceof r;Promise.resolve(y?p.v:p).then(function(d){if(y){var b=m==="return"?"return":"next";if(!p.k||d.done)return a(b,d);d=i[b](d).value}c(f.done?"return":"normal",d)},function(d){a("throw",d)})}catch(d){c("throw",d)}}function c(m,l){switch(m){case"return":u.resolve({value:l,done:!0});break;case"throw":u.reject(l);break;default:u.resolve({value:l,done:!1})}(u=u.next)?a(u.key,u.arg):s=null}this._invoke=function(m,l){return new Promise(function(f,p){var y={key:m,arg:l,resolve:f,reject:p,next:null};s?s=s.next=y:(u=s=y,a(m,l))})},typeof i.return!="function"&&(this.return=void 0)}n.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},n.prototype.next=function(i){return this._invoke("next",i)},n.prototype.throw=function(i){return this._invoke("throw",i)},n.prototype.return=function(i){return this._invoke("return",i)},e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Jr=h(Ne(),1),$r=h(Ue(),1),Yr=h(We(),1),Kr=h(v(),1);var Fe="https://rpc.dogeapi.io";function en(t={}){let{url:e=Fe,...r}=t;return ue({links:[z({...r,url:e,transformer:$})]})}export{Fe as DEFAULT_TRPC_URL,en as createDogecoinCoreClient};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
@trpc/client/dist/httpBatchLink-BOe5aCcR.mjs:
|
|
5
|
+
(* istanbul ignore if -- @preserve *)
|
|
6
|
+
*/
|