@inodra/sui 0.1.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 +202 -0
- package/README.md +237 -0
- package/bin/inodra-sui.mjs +2 -0
- package/dist/chunk-3CBLVI6J.js +426 -0
- package/dist/chunk-3CBLVI6J.js.map +1 -0
- package/dist/chunk-4HKKW5QN.js +80 -0
- package/dist/chunk-4HKKW5QN.js.map +1 -0
- package/dist/chunk-74XGJJJI.js +33 -0
- package/dist/chunk-74XGJJJI.js.map +1 -0
- package/dist/chunk-D6FZYWG7.js +99 -0
- package/dist/chunk-D6FZYWG7.js.map +1 -0
- package/dist/chunk-LZZMTSLH.js +31 -0
- package/dist/chunk-LZZMTSLH.js.map +1 -0
- package/dist/chunk-M3M2L6BW.js +29 -0
- package/dist/chunk-M3M2L6BW.js.map +1 -0
- package/dist/chunk-NSXRC5XW.js +298 -0
- package/dist/chunk-NSXRC5XW.js.map +1 -0
- package/dist/chunk-OGMBYWTG.js +537 -0
- package/dist/chunk-OGMBYWTG.js.map +1 -0
- package/dist/chunk-U6D5LGNF.js +111 -0
- package/dist/chunk-U6D5LGNF.js.map +1 -0
- package/dist/chunk-ZSW3EWGF.js +539 -0
- package/dist/chunk-ZSW3EWGF.js.map +1 -0
- package/dist/cli.js +665 -0
- package/dist/cli.js.map +1 -0
- package/dist/events.cjs +3273 -0
- package/dist/events.cjs.map +1 -0
- package/dist/events.d.cts +47 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +2578 -0
- package/dist/events.js.map +1 -0
- package/dist/graphql.cjs +129 -0
- package/dist/graphql.cjs.map +1 -0
- package/dist/graphql.d.cts +36 -0
- package/dist/graphql.d.ts +36 -0
- package/dist/graphql.js +10 -0
- package/dist/graphql.js.map +1 -0
- package/dist/grpc-web.cjs +129 -0
- package/dist/grpc-web.cjs.map +1 -0
- package/dist/grpc-web.d.cts +31 -0
- package/dist/grpc-web.d.ts +31 -0
- package/dist/grpc-web.js +10 -0
- package/dist/grpc-web.js.map +1 -0
- package/dist/grpc.cjs +131 -0
- package/dist/grpc.cjs.map +1 -0
- package/dist/grpc.d.cts +34 -0
- package/dist/grpc.d.ts +34 -0
- package/dist/grpc.js +10 -0
- package/dist/grpc.js.map +1 -0
- package/dist/index-CGBN_EI5.d.ts +4800 -0
- package/dist/index-CVO2Kj8a.d.cts +4800 -0
- package/dist/index.cjs +4723 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.ts +504 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/manage.cjs +376 -0
- package/dist/manage.cjs.map +1 -0
- package/dist/manage.d.cts +2 -0
- package/dist/manage.d.ts +2 -0
- package/dist/manage.js +8 -0
- package/dist/manage.js.map +1 -0
- package/dist/network-CEg2MJY3.d.cts +60 -0
- package/dist/network-CEg2MJY3.d.ts +60 -0
- package/dist/node.cjs +4759 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +28 -0
- package/dist/node.d.ts +28 -0
- package/dist/node.js +73 -0
- package/dist/node.js.map +1 -0
- package/dist/reflection-Bx44-Fs1.d.ts +4639 -0
- package/dist/reflection-Cf7WFH6H.d.cts +4639 -0
- package/dist/reflection-FEGYA7DU.js +9 -0
- package/dist/reflection-FEGYA7DU.js.map +1 -0
- package/dist/runtime-OWKF3LZ7.js +37 -0
- package/dist/runtime-OWKF3LZ7.js.map +1 -0
- package/dist/warp.cjs +633 -0
- package/dist/warp.cjs.map +1 -0
- package/dist/warp.d.cts +195 -0
- package/dist/warp.d.ts +195 -0
- package/dist/warp.js +12 -0
- package/dist/warp.js.map +1 -0
- package/dist/webhooks.cjs +104 -0
- package/dist/webhooks.cjs.map +1 -0
- package/dist/webhooks.d.cts +35 -0
- package/dist/webhooks.d.ts +35 -0
- package/dist/webhooks.js +7 -0
- package/dist/webhooks.js.map +1 -0
- package/llms.txt +189 -0
- package/package.json +119 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GraphQLDocument, SuiGraphQLClient } from '@mysten/sui/graphql';
|
|
2
|
+
export { GraphQLDocument, GraphQLQueryOptions, GraphQLQueryResult, SuiGraphQLClient } from '@mysten/sui/graphql';
|
|
3
|
+
import { I as InodraAuth, a as InodraNetwork } from './network-CEg2MJY3.js';
|
|
4
|
+
|
|
5
|
+
interface InodraGraphQLClientOptions<Queries extends Record<string, GraphQLDocument>> {
|
|
6
|
+
/** Credentials: an API key string, {apiKey}, or {sessionToken}. */
|
|
7
|
+
auth?: InodraAuth;
|
|
8
|
+
/** Shorthand for `auth: { apiKey }`. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** Defaults to "mainnet". Ignored when url is set. */
|
|
11
|
+
network?: InodraNetwork;
|
|
12
|
+
/** Overrides the network-derived GraphQL endpoint. */
|
|
13
|
+
url?: string;
|
|
14
|
+
/** Extra headers sent with every request. */
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
/** Named, typed queries usable via client.execute(name, ...). */
|
|
17
|
+
queries?: Queries;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* GraphQL client for Inodra's Sui GraphQL endpoint.
|
|
21
|
+
*
|
|
22
|
+
* Returns a fully featured `SuiGraphQLClient` from @mysten/sui,
|
|
23
|
+
* authenticated against Inodra.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { graphql } from "@mysten/sui/graphql/schemas/latest";
|
|
27
|
+
*
|
|
28
|
+
* const client = createInodraGraphQLClient({ apiKey });
|
|
29
|
+
* const result = await client.query({
|
|
30
|
+
* query: graphql(`query { chainIdentifier }`),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function createInodraGraphQLClient<Queries extends Record<string, GraphQLDocument> = Record<string, GraphQLDocument>>(options: InodraGraphQLClientOptions<Queries>): SuiGraphQLClient<Queries>;
|
|
35
|
+
|
|
36
|
+
export { type InodraGraphQLClientOptions, createInodraGraphQLClient };
|
package/dist/graphql.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/grpc-web/index.ts
|
|
21
|
+
var grpc_web_exports = {};
|
|
22
|
+
__export(grpc_web_exports, {
|
|
23
|
+
SuiGrpcClient: () => import_grpc2.SuiGrpcClient,
|
|
24
|
+
createInodraGrpcWebClient: () => createInodraGrpcWebClient
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(grpc_web_exports);
|
|
27
|
+
var import_grpc = require("@mysten/sui/grpc");
|
|
28
|
+
var import_grpcweb_transport = require("@protobuf-ts/grpcweb-transport");
|
|
29
|
+
|
|
30
|
+
// src/core/auth.ts
|
|
31
|
+
function resolveAuth(auth) {
|
|
32
|
+
if (typeof auth === "string") {
|
|
33
|
+
return staticAuth(apiKeyCredentials(auth));
|
|
34
|
+
}
|
|
35
|
+
if ("apiKey" in auth) {
|
|
36
|
+
return staticAuth(apiKeyCredentials(auth.apiKey));
|
|
37
|
+
}
|
|
38
|
+
if ("sessionToken" in auth) {
|
|
39
|
+
return staticAuth({
|
|
40
|
+
headers: { authorization: `Bearer ${auth.sessionToken}` }
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
credentials: async () => auth.getCredentials(),
|
|
45
|
+
staticCredentials: () => void 0
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function authFromOptions(options, context) {
|
|
49
|
+
if (options.auth !== void 0) {
|
|
50
|
+
return resolveAuth(options.auth);
|
|
51
|
+
}
|
|
52
|
+
if (options.apiKey) {
|
|
53
|
+
return resolveAuth(options.apiKey);
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`${context} requires auth (or the apiKey shorthand)`);
|
|
56
|
+
}
|
|
57
|
+
function staticAuthHeaders(options, context) {
|
|
58
|
+
const credentials = authFromOptions(options, context).staticCredentials();
|
|
59
|
+
if (!credentials) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`${context} does not support dynamic credential providers \u2014 pass an apiKey or sessionToken`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return credentials.headers;
|
|
65
|
+
}
|
|
66
|
+
function apiKeyCredentials(apiKey) {
|
|
67
|
+
if (!apiKey) {
|
|
68
|
+
throw new Error("Inodra auth: apiKey must be a non-empty string");
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
headers: { "x-api-key": apiKey },
|
|
72
|
+
queryParams: { api_key: apiKey }
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function staticAuth(credentials) {
|
|
76
|
+
return {
|
|
77
|
+
credentials: async () => credentials,
|
|
78
|
+
staticCredentials: () => credentials
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/core/network.ts
|
|
83
|
+
var INODRA_ENDPOINTS = {
|
|
84
|
+
mainnet: {
|
|
85
|
+
rest: "https://mainnet-api.inodra.com/v1",
|
|
86
|
+
graphql: "https://mainnet-api.inodra.com/v1/graphql",
|
|
87
|
+
/** host:port for native gRPC transports */
|
|
88
|
+
grpc: "mainnet-grpc.inodra.com:443",
|
|
89
|
+
/** base URL for gRPC-Web transports */
|
|
90
|
+
grpcWeb: "https://mainnet-grpc.inodra.com",
|
|
91
|
+
warpWs: "wss://mainnet-api.inodra.com/v1"
|
|
92
|
+
},
|
|
93
|
+
testnet: {
|
|
94
|
+
rest: "https://testnet-api.inodra.com/v1",
|
|
95
|
+
graphql: "https://testnet-api.inodra.com/v1/graphql",
|
|
96
|
+
grpc: "testnet-grpc.inodra.com:443",
|
|
97
|
+
grpcWeb: "https://testnet-grpc.inodra.com",
|
|
98
|
+
warpWs: "wss://testnet-api.inodra.com/v1"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
function grpcBaseUrl(network) {
|
|
102
|
+
return INODRA_ENDPOINTS[network].grpcWeb;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/core/version.ts
|
|
106
|
+
var SDK_VERSION = "0.1.0";
|
|
107
|
+
var SDK_HEADER_NAME = "x-inodra-sdk";
|
|
108
|
+
var SDK_HEADER_VALUE = `inodra-sdk-ts/${SDK_VERSION}`;
|
|
109
|
+
|
|
110
|
+
// src/grpc-web/index.ts
|
|
111
|
+
var import_grpc2 = require("@mysten/sui/grpc");
|
|
112
|
+
function createInodraGrpcWebClient(options) {
|
|
113
|
+
const network = options.network ?? "mainnet";
|
|
114
|
+
const transport = new import_grpcweb_transport.GrpcWebFetchTransport({
|
|
115
|
+
baseUrl: options.baseUrl ?? grpcBaseUrl(network),
|
|
116
|
+
meta: {
|
|
117
|
+
...staticAuthHeaders(options, "createInodraGrpcWebClient"),
|
|
118
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE,
|
|
119
|
+
...options.metadata
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return new import_grpc.SuiGrpcClient({ network, transport });
|
|
123
|
+
}
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
SuiGrpcClient,
|
|
127
|
+
createInodraGrpcWebClient
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=grpc-web.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grpc-web/index.ts","../src/core/auth.ts","../src/core/network.ts","../src/core/version.ts"],"sourcesContent":["import { SuiGrpcClient } from \"@mysten/sui/grpc\";\nimport { GrpcWebFetchTransport } from \"@protobuf-ts/grpcweb-transport\";\nimport { type InodraAuth, staticAuthHeaders } from \"../core/auth.js\";\nimport { grpcBaseUrl, type InodraNetwork } from \"../core/network.js\";\nimport { SDK_HEADER_NAME, SDK_HEADER_VALUE } from \"../core/version.js\";\n\nexport interface InodraGrpcWebClientOptions {\n\t/** Credentials: an API key string, {apiKey}, or {sessionToken}. */\n\tauth?: InodraAuth;\n\t/** Shorthand for `auth: { apiKey }`. */\n\tapiKey?: string;\n\t/** Defaults to \"mainnet\". */\n\tnetwork?: InodraNetwork;\n\t/** Overrides the network-derived base URL. */\n\tbaseUrl?: string;\n\t/** Extra metadata sent with every call. */\n\tmetadata?: Record<string, string>;\n}\n\n/**\n * gRPC-Web client for Inodra — works in browsers and any fetch-capable\n * runtime. For Node.js backends, prefer `@inodra/sui/grpc` (native HTTP/2).\n *\n * Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated\n * against Inodra's gRPC gateway.\n *\n * ```ts\n * const client = createInodraGrpcWebClient({ apiKey });\n * const checkpoint = await client.core.getCheckpoint({ sequenceNumber });\n * ```\n */\nexport function createInodraGrpcWebClient(\n\toptions: InodraGrpcWebClientOptions,\n): SuiGrpcClient {\n\tconst network = options.network ?? \"mainnet\";\n\t// SuiGrpcClient's built-in gRPC-Web mode drops the `meta` option, so the\n\t// transport (which honors it on every call) is constructed explicitly.\n\tconst transport = new GrpcWebFetchTransport({\n\t\tbaseUrl: options.baseUrl ?? grpcBaseUrl(network),\n\t\tmeta: {\n\t\t\t...staticAuthHeaders(options, \"createInodraGrpcWebClient\"),\n\t\t\t[SDK_HEADER_NAME]: SDK_HEADER_VALUE,\n\t\t\t...options.metadata,\n\t\t},\n\t});\n\treturn new SuiGrpcClient({ network, transport });\n}\n\nexport { SuiGrpcClient } from \"@mysten/sui/grpc\";\n","/**\n * Pluggable authentication for every Inodra transport.\n *\n * Most users pass an API key. The provider shape exists so future credential\n * types (x402 wallet session tokens, refreshing vault-issued keys) slot in\n * without changing any client constructor.\n */\n\nexport interface AuthCredentials {\n\t/** Sent as HTTP headers (REST, SSE, GraphQL) and gRPC metadata. */\n\theaders: Record<string, string>;\n\t/**\n\t * Sent as URL query parameters on transports that cannot carry headers\n\t * (WebSocket upgrades in browsers). Omit to disallow such transports.\n\t */\n\tqueryParams?: Record<string, string>;\n}\n\nexport type InodraAuth =\n\t| string\n\t| { apiKey: string }\n\t| { sessionToken: string }\n\t| {\n\t\t\tgetCredentials: () => AuthCredentials | Promise<AuthCredentials>;\n\t };\n\n/** Normalized auth handle used internally by every transport. */\nexport interface ResolvedAuth {\n\t/** Resolve credentials. Called per request on REST/SSE, per connect on WS. */\n\tcredentials(): Promise<AuthCredentials>;\n\t/**\n\t * Resolve credentials synchronously, or undefined for dynamic providers.\n\t * Used by clients whose underlying transport takes static headers\n\t * (gRPC, GraphQL).\n\t */\n\tstaticCredentials(): AuthCredentials | undefined;\n}\n\nexport function resolveAuth(auth: InodraAuth): ResolvedAuth {\n\tif (typeof auth === \"string\") {\n\t\treturn staticAuth(apiKeyCredentials(auth));\n\t}\n\tif (\"apiKey\" in auth) {\n\t\treturn staticAuth(apiKeyCredentials(auth.apiKey));\n\t}\n\tif (\"sessionToken\" in auth) {\n\t\treturn staticAuth({\n\t\t\theaders: { authorization: `Bearer ${auth.sessionToken}` },\n\t\t});\n\t}\n\treturn {\n\t\tcredentials: async () => auth.getCredentials(),\n\t\tstaticCredentials: () => undefined,\n\t};\n}\n\n/**\n * Resolve auth from an options bag that accepts both the modern `auth` field\n * and the original `apiKey` shorthand.\n */\nexport function authFromOptions(\n\toptions: { auth?: InodraAuth; apiKey?: string },\n\tcontext: string,\n): ResolvedAuth {\n\tif (options.auth !== undefined) {\n\t\treturn resolveAuth(options.auth);\n\t}\n\tif (options.apiKey) {\n\t\treturn resolveAuth(options.apiKey);\n\t}\n\tthrow new Error(`${context} requires auth (or the apiKey shorthand)`);\n}\n\n/**\n * Headers for clients whose transports take static headers (gRPC, GraphQL).\n * Dynamic providers are rejected: the underlying Mysten clients cannot\n * re-resolve credentials per call, so a snapshot would silently go stale.\n */\nexport function staticAuthHeaders(\n\toptions: { auth?: InodraAuth; apiKey?: string },\n\tcontext: string,\n): Record<string, string> {\n\tconst credentials = authFromOptions(options, context).staticCredentials();\n\tif (!credentials) {\n\t\tthrow new Error(\n\t\t\t`${context} does not support dynamic credential providers — pass an apiKey or sessionToken`,\n\t\t);\n\t}\n\treturn credentials.headers;\n}\n\nfunction apiKeyCredentials(apiKey: string): AuthCredentials {\n\tif (!apiKey) {\n\t\tthrow new Error(\"Inodra auth: apiKey must be a non-empty string\");\n\t}\n\treturn {\n\t\theaders: { \"x-api-key\": apiKey },\n\t\tqueryParams: { api_key: apiKey },\n\t};\n}\n\nfunction staticAuth(credentials: AuthCredentials): ResolvedAuth {\n\treturn {\n\t\tcredentials: async () => credentials,\n\t\tstaticCredentials: () => credentials,\n\t};\n}\n","export type InodraNetwork = \"mainnet\" | \"testnet\";\n\n/**\n * Canonical Inodra endpoints per network and protocol.\n */\nexport const INODRA_ENDPOINTS = {\n\tmainnet: {\n\t\trest: \"https://mainnet-api.inodra.com/v1\",\n\t\tgraphql: \"https://mainnet-api.inodra.com/v1/graphql\",\n\t\t/** host:port for native gRPC transports */\n\t\tgrpc: \"mainnet-grpc.inodra.com:443\",\n\t\t/** base URL for gRPC-Web transports */\n\t\tgrpcWeb: \"https://mainnet-grpc.inodra.com\",\n\t\twarpWs: \"wss://mainnet-api.inodra.com/v1\",\n\t},\n\ttestnet: {\n\t\trest: \"https://testnet-api.inodra.com/v1\",\n\t\tgraphql: \"https://testnet-api.inodra.com/v1/graphql\",\n\t\tgrpc: \"testnet-grpc.inodra.com:443\",\n\t\tgrpcWeb: \"https://testnet-grpc.inodra.com\",\n\t\twarpWs: \"wss://testnet-api.inodra.com/v1\",\n\t},\n} as const satisfies Record<\n\tInodraNetwork,\n\t{ rest: string; graphql: string; grpc: string; grpcWeb: string; warpWs: string }\n>;\n\nexport function restBaseUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].rest;\n}\n\nexport function graphqlUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].graphql;\n}\n\n/** Base URL for gRPC-Web / Connect transports. */\nexport function grpcBaseUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].grpcWeb;\n}\n\n/** host:port for native gRPC transports. */\nexport function grpcHost(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].grpc;\n}\n\nexport function warpStreamUrl(\n\tnetwork: InodraNetwork,\n\tsubscriptionId: string,\n): string {\n\treturn `${INODRA_ENDPOINTS[network].rest}/warp/${subscriptionId}/stream`;\n}\n\nexport function warpWebSocketUrl(\n\tnetwork: InodraNetwork,\n\tsubscriptionId: string,\n): string {\n\treturn `${INODRA_ENDPOINTS[network].warpWs}/warp/${subscriptionId}/ws`;\n}\n","export const SDK_VERSION = \"0.1.0\";\n\n/**\n * Identifies the SDK to Inodra on every request, alongside the API key.\n * Sent on REST, GraphQL, SSE (headers) and gRPC (metadata). Browsers cannot\n * attach headers to WebSocket upgrades, so the Warp WS client omits it.\n */\nexport const SDK_HEADER_NAME = \"x-inodra-sdk\";\nexport const SDK_HEADER_VALUE = `inodra-sdk-ts/${SDK_VERSION}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAC9B,+BAAsC;;;ACqC/B,SAAS,YAAY,MAAgC;AAC3D,MAAI,OAAO,SAAS,UAAU;AAC7B,WAAO,WAAW,kBAAkB,IAAI,CAAC;AAAA,EAC1C;AACA,MAAI,YAAY,MAAM;AACrB,WAAO,WAAW,kBAAkB,KAAK,MAAM,CAAC;AAAA,EACjD;AACA,MAAI,kBAAkB,MAAM;AAC3B,WAAO,WAAW;AAAA,MACjB,SAAS,EAAE,eAAe,UAAU,KAAK,YAAY,GAAG;AAAA,IACzD,CAAC;AAAA,EACF;AACA,SAAO;AAAA,IACN,aAAa,YAAY,KAAK,eAAe;AAAA,IAC7C,mBAAmB,MAAM;AAAA,EAC1B;AACD;AAMO,SAAS,gBACf,SACA,SACe;AACf,MAAI,QAAQ,SAAS,QAAW;AAC/B,WAAO,YAAY,QAAQ,IAAI;AAAA,EAChC;AACA,MAAI,QAAQ,QAAQ;AACnB,WAAO,YAAY,QAAQ,MAAM;AAAA,EAClC;AACA,QAAM,IAAI,MAAM,GAAG,OAAO,0CAA0C;AACrE;AAOO,SAAS,kBACf,SACA,SACyB;AACzB,QAAM,cAAc,gBAAgB,SAAS,OAAO,EAAE,kBAAkB;AACxE,MAAI,CAAC,aAAa;AACjB,UAAM,IAAI;AAAA,MACT,GAAG,OAAO;AAAA,IACX;AAAA,EACD;AACA,SAAO,YAAY;AACpB;AAEA,SAAS,kBAAkB,QAAiC;AAC3D,MAAI,CAAC,QAAQ;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EACjE;AACA,SAAO;AAAA,IACN,SAAS,EAAE,aAAa,OAAO;AAAA,IAC/B,aAAa,EAAE,SAAS,OAAO;AAAA,EAChC;AACD;AAEA,SAAS,WAAW,aAA4C;AAC/D,SAAO;AAAA,IACN,aAAa,YAAY;AAAA,IACzB,mBAAmB,MAAM;AAAA,EAC1B;AACD;;;ACrGO,IAAM,mBAAmB;AAAA,EAC/B,SAAS;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,IAET,MAAM;AAAA;AAAA,IAEN,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AACD;AAcO,SAAS,YAAY,SAAgC;AAC3D,SAAO,iBAAiB,OAAO,EAAE;AAClC;;;ACtCO,IAAM,cAAc;AAOpB,IAAM,kBAAkB;AACxB,IAAM,mBAAmB,iBAAiB,WAAW;;;AHwC5D,IAAAA,eAA8B;AAjBvB,SAAS,0BACf,SACgB;AAChB,QAAM,UAAU,QAAQ,WAAW;AAGnC,QAAM,YAAY,IAAI,+CAAsB;AAAA,IAC3C,SAAS,QAAQ,WAAW,YAAY,OAAO;AAAA,IAC/C,MAAM;AAAA,MACL,GAAG,kBAAkB,SAAS,2BAA2B;AAAA,MACzD,CAAC,eAAe,GAAG;AAAA,MACnB,GAAG,QAAQ;AAAA,IACZ;AAAA,EACD,CAAC;AACD,SAAO,IAAI,0BAAc,EAAE,SAAS,UAAU,CAAC;AAChD;","names":["import_grpc"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
export { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
import { I as InodraAuth, a as InodraNetwork } from './network-CEg2MJY3.cjs';
|
|
4
|
+
|
|
5
|
+
interface InodraGrpcWebClientOptions {
|
|
6
|
+
/** Credentials: an API key string, {apiKey}, or {sessionToken}. */
|
|
7
|
+
auth?: InodraAuth;
|
|
8
|
+
/** Shorthand for `auth: { apiKey }`. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** Defaults to "mainnet". */
|
|
11
|
+
network?: InodraNetwork;
|
|
12
|
+
/** Overrides the network-derived base URL. */
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/** Extra metadata sent with every call. */
|
|
15
|
+
metadata?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* gRPC-Web client for Inodra — works in browsers and any fetch-capable
|
|
19
|
+
* runtime. For Node.js backends, prefer `@inodra/sui/grpc` (native HTTP/2).
|
|
20
|
+
*
|
|
21
|
+
* Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated
|
|
22
|
+
* against Inodra's gRPC gateway.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const client = createInodraGrpcWebClient({ apiKey });
|
|
26
|
+
* const checkpoint = await client.core.getCheckpoint({ sequenceNumber });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function createInodraGrpcWebClient(options: InodraGrpcWebClientOptions): SuiGrpcClient;
|
|
30
|
+
|
|
31
|
+
export { type InodraGrpcWebClientOptions, createInodraGrpcWebClient };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
export { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
import { I as InodraAuth, a as InodraNetwork } from './network-CEg2MJY3.js';
|
|
4
|
+
|
|
5
|
+
interface InodraGrpcWebClientOptions {
|
|
6
|
+
/** Credentials: an API key string, {apiKey}, or {sessionToken}. */
|
|
7
|
+
auth?: InodraAuth;
|
|
8
|
+
/** Shorthand for `auth: { apiKey }`. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** Defaults to "mainnet". */
|
|
11
|
+
network?: InodraNetwork;
|
|
12
|
+
/** Overrides the network-derived base URL. */
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/** Extra metadata sent with every call. */
|
|
15
|
+
metadata?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* gRPC-Web client for Inodra — works in browsers and any fetch-capable
|
|
19
|
+
* runtime. For Node.js backends, prefer `@inodra/sui/grpc` (native HTTP/2).
|
|
20
|
+
*
|
|
21
|
+
* Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated
|
|
22
|
+
* against Inodra's gRPC gateway.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const client = createInodraGrpcWebClient({ apiKey });
|
|
26
|
+
* const checkpoint = await client.core.getCheckpoint({ sequenceNumber });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function createInodraGrpcWebClient(options: InodraGrpcWebClientOptions): SuiGrpcClient;
|
|
30
|
+
|
|
31
|
+
export { type InodraGrpcWebClientOptions, createInodraGrpcWebClient };
|
package/dist/grpc-web.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/grpc.cjs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/grpc/index.ts
|
|
21
|
+
var grpc_exports = {};
|
|
22
|
+
__export(grpc_exports, {
|
|
23
|
+
SuiGrpcClient: () => import_grpc2.SuiGrpcClient,
|
|
24
|
+
createInodraGrpcClient: () => createInodraGrpcClient
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(grpc_exports);
|
|
27
|
+
var import_grpc_js = require("@grpc/grpc-js");
|
|
28
|
+
var import_grpc = require("@mysten/sui/grpc");
|
|
29
|
+
var import_grpc_transport = require("@protobuf-ts/grpc-transport");
|
|
30
|
+
|
|
31
|
+
// src/core/auth.ts
|
|
32
|
+
function resolveAuth(auth) {
|
|
33
|
+
if (typeof auth === "string") {
|
|
34
|
+
return staticAuth(apiKeyCredentials(auth));
|
|
35
|
+
}
|
|
36
|
+
if ("apiKey" in auth) {
|
|
37
|
+
return staticAuth(apiKeyCredentials(auth.apiKey));
|
|
38
|
+
}
|
|
39
|
+
if ("sessionToken" in auth) {
|
|
40
|
+
return staticAuth({
|
|
41
|
+
headers: { authorization: `Bearer ${auth.sessionToken}` }
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
credentials: async () => auth.getCredentials(),
|
|
46
|
+
staticCredentials: () => void 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function authFromOptions(options, context) {
|
|
50
|
+
if (options.auth !== void 0) {
|
|
51
|
+
return resolveAuth(options.auth);
|
|
52
|
+
}
|
|
53
|
+
if (options.apiKey) {
|
|
54
|
+
return resolveAuth(options.apiKey);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`${context} requires auth (or the apiKey shorthand)`);
|
|
57
|
+
}
|
|
58
|
+
function staticAuthHeaders(options, context) {
|
|
59
|
+
const credentials = authFromOptions(options, context).staticCredentials();
|
|
60
|
+
if (!credentials) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`${context} does not support dynamic credential providers \u2014 pass an apiKey or sessionToken`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return credentials.headers;
|
|
66
|
+
}
|
|
67
|
+
function apiKeyCredentials(apiKey) {
|
|
68
|
+
if (!apiKey) {
|
|
69
|
+
throw new Error("Inodra auth: apiKey must be a non-empty string");
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
headers: { "x-api-key": apiKey },
|
|
73
|
+
queryParams: { api_key: apiKey }
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function staticAuth(credentials) {
|
|
77
|
+
return {
|
|
78
|
+
credentials: async () => credentials,
|
|
79
|
+
staticCredentials: () => credentials
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/core/network.ts
|
|
84
|
+
var INODRA_ENDPOINTS = {
|
|
85
|
+
mainnet: {
|
|
86
|
+
rest: "https://mainnet-api.inodra.com/v1",
|
|
87
|
+
graphql: "https://mainnet-api.inodra.com/v1/graphql",
|
|
88
|
+
/** host:port for native gRPC transports */
|
|
89
|
+
grpc: "mainnet-grpc.inodra.com:443",
|
|
90
|
+
/** base URL for gRPC-Web transports */
|
|
91
|
+
grpcWeb: "https://mainnet-grpc.inodra.com",
|
|
92
|
+
warpWs: "wss://mainnet-api.inodra.com/v1"
|
|
93
|
+
},
|
|
94
|
+
testnet: {
|
|
95
|
+
rest: "https://testnet-api.inodra.com/v1",
|
|
96
|
+
graphql: "https://testnet-api.inodra.com/v1/graphql",
|
|
97
|
+
grpc: "testnet-grpc.inodra.com:443",
|
|
98
|
+
grpcWeb: "https://testnet-grpc.inodra.com",
|
|
99
|
+
warpWs: "wss://testnet-api.inodra.com/v1"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
function grpcHost(network) {
|
|
103
|
+
return INODRA_ENDPOINTS[network].grpc;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/core/version.ts
|
|
107
|
+
var SDK_VERSION = "0.1.0";
|
|
108
|
+
var SDK_HEADER_NAME = "x-inodra-sdk";
|
|
109
|
+
var SDK_HEADER_VALUE = `inodra-sdk-ts/${SDK_VERSION}`;
|
|
110
|
+
|
|
111
|
+
// src/grpc/index.ts
|
|
112
|
+
var import_grpc2 = require("@mysten/sui/grpc");
|
|
113
|
+
function createInodraGrpcClient(options) {
|
|
114
|
+
const network = options.network ?? "mainnet";
|
|
115
|
+
const transport = new import_grpc_transport.GrpcTransport({
|
|
116
|
+
host: options.host ?? grpcHost(network),
|
|
117
|
+
channelCredentials: options.channelCredentials ?? import_grpc_js.ChannelCredentials.createSsl(),
|
|
118
|
+
meta: {
|
|
119
|
+
...staticAuthHeaders(options, "createInodraGrpcClient"),
|
|
120
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE,
|
|
121
|
+
...options.metadata
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return new import_grpc.SuiGrpcClient({ network, transport });
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
SuiGrpcClient,
|
|
129
|
+
createInodraGrpcClient
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=grpc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grpc/index.ts","../src/core/auth.ts","../src/core/network.ts","../src/core/version.ts"],"sourcesContent":["import { ChannelCredentials } from \"@grpc/grpc-js\";\nimport { SuiGrpcClient } from \"@mysten/sui/grpc\";\nimport { GrpcTransport } from \"@protobuf-ts/grpc-transport\";\nimport { type InodraAuth, staticAuthHeaders } from \"../core/auth.js\";\nimport { grpcHost, type InodraNetwork } from \"../core/network.js\";\nimport { SDK_HEADER_NAME, SDK_HEADER_VALUE } from \"../core/version.js\";\n\nexport interface InodraGrpcClientOptions {\n\t/** Credentials: an API key string, {apiKey}, or {sessionToken}. */\n\tauth?: InodraAuth;\n\t/** Shorthand for `auth: { apiKey }`. */\n\tapiKey?: string;\n\t/** Defaults to \"mainnet\". */\n\tnetwork?: InodraNetwork;\n\t/** Overrides the network-derived host:port (e.g. localhost:50051). */\n\thost?: string;\n\t/** Defaults to TLS. Pass ChannelCredentials.createInsecure() for local dev. */\n\tchannelCredentials?: ChannelCredentials;\n\t/** Extra metadata sent with every call. */\n\tmetadata?: Record<string, string>;\n}\n\n/**\n * Native gRPC client for Inodra (Node.js only — uses HTTP/2 via @grpc/grpc-js).\n * For browsers, use `@inodra/sui/grpc-web` instead.\n *\n * Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated\n * against Inodra's gRPC gateway.\n *\n * ```ts\n * const client = createInodraGrpcClient({ apiKey });\n * const tx = await client.getTransaction({ digest: \"...\" });\n * ```\n */\nexport function createInodraGrpcClient(\n\toptions: InodraGrpcClientOptions,\n): SuiGrpcClient {\n\tconst network = options.network ?? \"mainnet\";\n\tconst transport = new GrpcTransport({\n\t\thost: options.host ?? grpcHost(network),\n\t\tchannelCredentials: options.channelCredentials ?? ChannelCredentials.createSsl(),\n\t\tmeta: {\n\t\t\t...staticAuthHeaders(options, \"createInodraGrpcClient\"),\n\t\t\t[SDK_HEADER_NAME]: SDK_HEADER_VALUE,\n\t\t\t...options.metadata,\n\t\t},\n\t});\n\treturn new SuiGrpcClient({ network, transport });\n}\n\nexport { SuiGrpcClient } from \"@mysten/sui/grpc\";\n","/**\n * Pluggable authentication for every Inodra transport.\n *\n * Most users pass an API key. The provider shape exists so future credential\n * types (x402 wallet session tokens, refreshing vault-issued keys) slot in\n * without changing any client constructor.\n */\n\nexport interface AuthCredentials {\n\t/** Sent as HTTP headers (REST, SSE, GraphQL) and gRPC metadata. */\n\theaders: Record<string, string>;\n\t/**\n\t * Sent as URL query parameters on transports that cannot carry headers\n\t * (WebSocket upgrades in browsers). Omit to disallow such transports.\n\t */\n\tqueryParams?: Record<string, string>;\n}\n\nexport type InodraAuth =\n\t| string\n\t| { apiKey: string }\n\t| { sessionToken: string }\n\t| {\n\t\t\tgetCredentials: () => AuthCredentials | Promise<AuthCredentials>;\n\t };\n\n/** Normalized auth handle used internally by every transport. */\nexport interface ResolvedAuth {\n\t/** Resolve credentials. Called per request on REST/SSE, per connect on WS. */\n\tcredentials(): Promise<AuthCredentials>;\n\t/**\n\t * Resolve credentials synchronously, or undefined for dynamic providers.\n\t * Used by clients whose underlying transport takes static headers\n\t * (gRPC, GraphQL).\n\t */\n\tstaticCredentials(): AuthCredentials | undefined;\n}\n\nexport function resolveAuth(auth: InodraAuth): ResolvedAuth {\n\tif (typeof auth === \"string\") {\n\t\treturn staticAuth(apiKeyCredentials(auth));\n\t}\n\tif (\"apiKey\" in auth) {\n\t\treturn staticAuth(apiKeyCredentials(auth.apiKey));\n\t}\n\tif (\"sessionToken\" in auth) {\n\t\treturn staticAuth({\n\t\t\theaders: { authorization: `Bearer ${auth.sessionToken}` },\n\t\t});\n\t}\n\treturn {\n\t\tcredentials: async () => auth.getCredentials(),\n\t\tstaticCredentials: () => undefined,\n\t};\n}\n\n/**\n * Resolve auth from an options bag that accepts both the modern `auth` field\n * and the original `apiKey` shorthand.\n */\nexport function authFromOptions(\n\toptions: { auth?: InodraAuth; apiKey?: string },\n\tcontext: string,\n): ResolvedAuth {\n\tif (options.auth !== undefined) {\n\t\treturn resolveAuth(options.auth);\n\t}\n\tif (options.apiKey) {\n\t\treturn resolveAuth(options.apiKey);\n\t}\n\tthrow new Error(`${context} requires auth (or the apiKey shorthand)`);\n}\n\n/**\n * Headers for clients whose transports take static headers (gRPC, GraphQL).\n * Dynamic providers are rejected: the underlying Mysten clients cannot\n * re-resolve credentials per call, so a snapshot would silently go stale.\n */\nexport function staticAuthHeaders(\n\toptions: { auth?: InodraAuth; apiKey?: string },\n\tcontext: string,\n): Record<string, string> {\n\tconst credentials = authFromOptions(options, context).staticCredentials();\n\tif (!credentials) {\n\t\tthrow new Error(\n\t\t\t`${context} does not support dynamic credential providers — pass an apiKey or sessionToken`,\n\t\t);\n\t}\n\treturn credentials.headers;\n}\n\nfunction apiKeyCredentials(apiKey: string): AuthCredentials {\n\tif (!apiKey) {\n\t\tthrow new Error(\"Inodra auth: apiKey must be a non-empty string\");\n\t}\n\treturn {\n\t\theaders: { \"x-api-key\": apiKey },\n\t\tqueryParams: { api_key: apiKey },\n\t};\n}\n\nfunction staticAuth(credentials: AuthCredentials): ResolvedAuth {\n\treturn {\n\t\tcredentials: async () => credentials,\n\t\tstaticCredentials: () => credentials,\n\t};\n}\n","export type InodraNetwork = \"mainnet\" | \"testnet\";\n\n/**\n * Canonical Inodra endpoints per network and protocol.\n */\nexport const INODRA_ENDPOINTS = {\n\tmainnet: {\n\t\trest: \"https://mainnet-api.inodra.com/v1\",\n\t\tgraphql: \"https://mainnet-api.inodra.com/v1/graphql\",\n\t\t/** host:port for native gRPC transports */\n\t\tgrpc: \"mainnet-grpc.inodra.com:443\",\n\t\t/** base URL for gRPC-Web transports */\n\t\tgrpcWeb: \"https://mainnet-grpc.inodra.com\",\n\t\twarpWs: \"wss://mainnet-api.inodra.com/v1\",\n\t},\n\ttestnet: {\n\t\trest: \"https://testnet-api.inodra.com/v1\",\n\t\tgraphql: \"https://testnet-api.inodra.com/v1/graphql\",\n\t\tgrpc: \"testnet-grpc.inodra.com:443\",\n\t\tgrpcWeb: \"https://testnet-grpc.inodra.com\",\n\t\twarpWs: \"wss://testnet-api.inodra.com/v1\",\n\t},\n} as const satisfies Record<\n\tInodraNetwork,\n\t{ rest: string; graphql: string; grpc: string; grpcWeb: string; warpWs: string }\n>;\n\nexport function restBaseUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].rest;\n}\n\nexport function graphqlUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].graphql;\n}\n\n/** Base URL for gRPC-Web / Connect transports. */\nexport function grpcBaseUrl(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].grpcWeb;\n}\n\n/** host:port for native gRPC transports. */\nexport function grpcHost(network: InodraNetwork): string {\n\treturn INODRA_ENDPOINTS[network].grpc;\n}\n\nexport function warpStreamUrl(\n\tnetwork: InodraNetwork,\n\tsubscriptionId: string,\n): string {\n\treturn `${INODRA_ENDPOINTS[network].rest}/warp/${subscriptionId}/stream`;\n}\n\nexport function warpWebSocketUrl(\n\tnetwork: InodraNetwork,\n\tsubscriptionId: string,\n): string {\n\treturn `${INODRA_ENDPOINTS[network].warpWs}/warp/${subscriptionId}/ws`;\n}\n","export const SDK_VERSION = \"0.1.0\";\n\n/**\n * Identifies the SDK to Inodra on every request, alongside the API key.\n * Sent on REST, GraphQL, SSE (headers) and gRPC (metadata). Browsers cannot\n * attach headers to WebSocket upgrades, so the Warp WS client omits it.\n */\nexport const SDK_HEADER_NAME = \"x-inodra-sdk\";\nexport const SDK_HEADER_VALUE = `inodra-sdk-ts/${SDK_VERSION}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmC;AACnC,kBAA8B;AAC9B,4BAA8B;;;ACoCvB,SAAS,YAAY,MAAgC;AAC3D,MAAI,OAAO,SAAS,UAAU;AAC7B,WAAO,WAAW,kBAAkB,IAAI,CAAC;AAAA,EAC1C;AACA,MAAI,YAAY,MAAM;AACrB,WAAO,WAAW,kBAAkB,KAAK,MAAM,CAAC;AAAA,EACjD;AACA,MAAI,kBAAkB,MAAM;AAC3B,WAAO,WAAW;AAAA,MACjB,SAAS,EAAE,eAAe,UAAU,KAAK,YAAY,GAAG;AAAA,IACzD,CAAC;AAAA,EACF;AACA,SAAO;AAAA,IACN,aAAa,YAAY,KAAK,eAAe;AAAA,IAC7C,mBAAmB,MAAM;AAAA,EAC1B;AACD;AAMO,SAAS,gBACf,SACA,SACe;AACf,MAAI,QAAQ,SAAS,QAAW;AAC/B,WAAO,YAAY,QAAQ,IAAI;AAAA,EAChC;AACA,MAAI,QAAQ,QAAQ;AACnB,WAAO,YAAY,QAAQ,MAAM;AAAA,EAClC;AACA,QAAM,IAAI,MAAM,GAAG,OAAO,0CAA0C;AACrE;AAOO,SAAS,kBACf,SACA,SACyB;AACzB,QAAM,cAAc,gBAAgB,SAAS,OAAO,EAAE,kBAAkB;AACxE,MAAI,CAAC,aAAa;AACjB,UAAM,IAAI;AAAA,MACT,GAAG,OAAO;AAAA,IACX;AAAA,EACD;AACA,SAAO,YAAY;AACpB;AAEA,SAAS,kBAAkB,QAAiC;AAC3D,MAAI,CAAC,QAAQ;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EACjE;AACA,SAAO;AAAA,IACN,SAAS,EAAE,aAAa,OAAO;AAAA,IAC/B,aAAa,EAAE,SAAS,OAAO;AAAA,EAChC;AACD;AAEA,SAAS,WAAW,aAA4C;AAC/D,SAAO;AAAA,IACN,aAAa,YAAY;AAAA,IACzB,mBAAmB,MAAM;AAAA,EAC1B;AACD;;;ACrGO,IAAM,mBAAmB;AAAA,EAC/B,SAAS;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,IAET,MAAM;AAAA;AAAA,IAEN,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AACD;AAmBO,SAAS,SAAS,SAAgC;AACxD,SAAO,iBAAiB,OAAO,EAAE;AAClC;;;AC3CO,IAAM,cAAc;AAOpB,IAAM,kBAAkB;AACxB,IAAM,mBAAmB,iBAAiB,WAAW;;;AH0C5D,IAAAA,eAA8B;AAhBvB,SAAS,uBACf,SACgB;AAChB,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,YAAY,IAAI,oCAAc;AAAA,IACnC,MAAM,QAAQ,QAAQ,SAAS,OAAO;AAAA,IACtC,oBAAoB,QAAQ,sBAAsB,kCAAmB,UAAU;AAAA,IAC/E,MAAM;AAAA,MACL,GAAG,kBAAkB,SAAS,wBAAwB;AAAA,MACtD,CAAC,eAAe,GAAG;AAAA,MACnB,GAAG,QAAQ;AAAA,IACZ;AAAA,EACD,CAAC;AACD,SAAO,IAAI,0BAAc,EAAE,SAAS,UAAU,CAAC;AAChD;","names":["import_grpc"]}
|
package/dist/grpc.d.cts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ChannelCredentials } from '@grpc/grpc-js';
|
|
2
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
export { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
|
+
import { I as InodraAuth, a as InodraNetwork } from './network-CEg2MJY3.cjs';
|
|
5
|
+
|
|
6
|
+
interface InodraGrpcClientOptions {
|
|
7
|
+
/** Credentials: an API key string, {apiKey}, or {sessionToken}. */
|
|
8
|
+
auth?: InodraAuth;
|
|
9
|
+
/** Shorthand for `auth: { apiKey }`. */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Defaults to "mainnet". */
|
|
12
|
+
network?: InodraNetwork;
|
|
13
|
+
/** Overrides the network-derived host:port (e.g. localhost:50051). */
|
|
14
|
+
host?: string;
|
|
15
|
+
/** Defaults to TLS. Pass ChannelCredentials.createInsecure() for local dev. */
|
|
16
|
+
channelCredentials?: ChannelCredentials;
|
|
17
|
+
/** Extra metadata sent with every call. */
|
|
18
|
+
metadata?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Native gRPC client for Inodra (Node.js only — uses HTTP/2 via @grpc/grpc-js).
|
|
22
|
+
* For browsers, use `@inodra/sui/grpc-web` instead.
|
|
23
|
+
*
|
|
24
|
+
* Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated
|
|
25
|
+
* against Inodra's gRPC gateway.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* const client = createInodraGrpcClient({ apiKey });
|
|
29
|
+
* const tx = await client.getTransaction({ digest: "..." });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function createInodraGrpcClient(options: InodraGrpcClientOptions): SuiGrpcClient;
|
|
33
|
+
|
|
34
|
+
export { type InodraGrpcClientOptions, createInodraGrpcClient };
|
package/dist/grpc.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ChannelCredentials } from '@grpc/grpc-js';
|
|
2
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
export { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
|
+
import { I as InodraAuth, a as InodraNetwork } from './network-CEg2MJY3.js';
|
|
5
|
+
|
|
6
|
+
interface InodraGrpcClientOptions {
|
|
7
|
+
/** Credentials: an API key string, {apiKey}, or {sessionToken}. */
|
|
8
|
+
auth?: InodraAuth;
|
|
9
|
+
/** Shorthand for `auth: { apiKey }`. */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Defaults to "mainnet". */
|
|
12
|
+
network?: InodraNetwork;
|
|
13
|
+
/** Overrides the network-derived host:port (e.g. localhost:50051). */
|
|
14
|
+
host?: string;
|
|
15
|
+
/** Defaults to TLS. Pass ChannelCredentials.createInsecure() for local dev. */
|
|
16
|
+
channelCredentials?: ChannelCredentials;
|
|
17
|
+
/** Extra metadata sent with every call. */
|
|
18
|
+
metadata?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Native gRPC client for Inodra (Node.js only — uses HTTP/2 via @grpc/grpc-js).
|
|
22
|
+
* For browsers, use `@inodra/sui/grpc-web` instead.
|
|
23
|
+
*
|
|
24
|
+
* Returns a fully featured `SuiGrpcClient` from @mysten/sui, authenticated
|
|
25
|
+
* against Inodra's gRPC gateway.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* const client = createInodraGrpcClient({ apiKey });
|
|
29
|
+
* const tx = await client.getTransaction({ digest: "..." });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function createInodraGrpcClient(options: InodraGrpcClientOptions): SuiGrpcClient;
|
|
33
|
+
|
|
34
|
+
export { type InodraGrpcClientOptions, createInodraGrpcClient };
|
package/dist/grpc.js
ADDED
package/dist/grpc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|