@t-0/provider-sdk 1.1.15 → 1.1.16

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.
@@ -97,7 +97,10 @@ export var CreatePaymentIntentResponse_Failure_Reason;
97
97
  CreatePaymentIntentResponse_Failure_Reason[CreatePaymentIntentResponse_Failure_Reason["FAILURE_REASON_UNSPECIFIED"] = 0] = "FAILURE_REASON_UNSPECIFIED";
98
98
  /**
99
99
  * *
100
- * No quotes found for the requested currency/amount.
100
+ * No live quote covers the requested currency/amount. On first call this
101
+ * means the intent was never created. On an idempotent retry this means
102
+ * every stored offer has since lost its live quote; a subsequent retry
103
+ * may succeed once providers republish.
101
104
  *
102
105
  * @generated from enum value: FAILURE_REASON_QUOTE_NOT_FOUND = 10;
103
106
  */
@@ -0,0 +1,119 @@
1
+ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Timestamp } from "@bufbuild/protobuf/wkt";
3
+ import type { Message } from "@bufbuild/protobuf";
4
+ /**
5
+ * Describes the file tzero/v1/system/system.proto.
6
+ */
7
+ export declare const file_tzero_v1_system_system: GenFile;
8
+ /**
9
+ * @generated from message tzero.v1.system.HealthRequest
10
+ */
11
+ export type HealthRequest = Message<"tzero.v1.system.HealthRequest"> & {};
12
+ /**
13
+ * Describes the message tzero.v1.system.HealthRequest.
14
+ * Use `create(HealthRequestSchema)` to create a new message.
15
+ */
16
+ export declare const HealthRequestSchema: GenMessage<HealthRequest>;
17
+ /**
18
+ * @generated from message tzero.v1.system.HealthResponse
19
+ */
20
+ export type HealthResponse = Message<"tzero.v1.system.HealthResponse"> & {
21
+ /**
22
+ * *
23
+ * Fully-qualified protobuf service names registered on this server, e.g.
24
+ * "tzero.v1.payment.ProviderService". Always includes
25
+ * "tzero.v1.system.SystemService".
26
+ *
27
+ * @generated from field: repeated string services = 10;
28
+ */
29
+ services: string[];
30
+ /**
31
+ * *
32
+ * Server wall-clock time. Useful to detect clock skew between the network
33
+ * and the provider.
34
+ *
35
+ * @generated from field: google.protobuf.Timestamp current_time = 20;
36
+ */
37
+ currentTime?: Timestamp | undefined;
38
+ /**
39
+ * *
40
+ * Semver of the provider SDK package, e.g. "1.1.15".
41
+ *
42
+ * @generated from field: string sdk_version = 30;
43
+ */
44
+ sdkVersion: string;
45
+ /**
46
+ * *
47
+ * Which SDK runtime/ecosystem this provider was built against.
48
+ *
49
+ * @generated from field: tzero.v1.system.SdkEcosystem sdk_ecosystem = 40;
50
+ */
51
+ sdkEcosystem: SdkEcosystem;
52
+ };
53
+ /**
54
+ * Describes the message tzero.v1.system.HealthResponse.
55
+ * Use `create(HealthResponseSchema)` to create a new message.
56
+ */
57
+ export declare const HealthResponseSchema: GenMessage<HealthResponse>;
58
+ /**
59
+ * @generated from enum tzero.v1.system.SdkEcosystem
60
+ */
61
+ export declare enum SdkEcosystem {
62
+ /**
63
+ * @generated from enum value: SDK_ECOSYSTEM_UNSPECIFIED = 0;
64
+ */
65
+ UNSPECIFIED = 0,
66
+ /**
67
+ * @generated from enum value: SDK_ECOSYSTEM_GO = 10;
68
+ */
69
+ GO = 10,
70
+ /**
71
+ * @generated from enum value: SDK_ECOSYSTEM_NODE = 20;
72
+ */
73
+ NODE = 20,
74
+ /**
75
+ * @generated from enum value: SDK_ECOSYSTEM_PYTHON = 30;
76
+ */
77
+ PYTHON = 30,
78
+ /**
79
+ * @generated from enum value: SDK_ECOSYSTEM_JAVA = 40;
80
+ */
81
+ JAVA = 40,
82
+ /**
83
+ * @generated from enum value: SDK_ECOSYSTEM_CSHARP = 50;
84
+ */
85
+ CSHARP = 50
86
+ }
87
+ /**
88
+ * Describes the enum tzero.v1.system.SdkEcosystem.
89
+ */
90
+ export declare const SdkEcosystemSchema: GenEnum<SdkEcosystem>;
91
+ /**
92
+ * *
93
+ * SystemService exposes operational/introspection RPCs on a provider
94
+ * endpoint. It is automatically registered by every provider SDK;
95
+ * customers do not implement it themselves. Calls are signed with the
96
+ * T-0 Network keypair, just like every other provider RPC.
97
+ *
98
+ * Health() is the first RPC. Future operational endpoints (e.g.
99
+ * Diagnostics, BuildInfo) belong on this service so customers continue
100
+ * to get them automatically as they upgrade the SDK.
101
+ *
102
+ * @generated from service tzero.v1.system.SystemService
103
+ */
104
+ export declare const SystemService: GenService<{
105
+ /**
106
+ * *
107
+ * Health returns the list of RPC services registered on this provider,
108
+ * the server's current wall-clock time, and the SDK build identifying
109
+ * this deployment. The returned `services` list always includes
110
+ * "tzero.v1.system.SystemService" itself.
111
+ *
112
+ * @generated from rpc tzero.v1.system.SystemService.Health
113
+ */
114
+ health: {
115
+ methodKind: "unary";
116
+ input: typeof HealthRequestSchema;
117
+ output: typeof HealthResponseSchema;
118
+ };
119
+ }>;
@@ -0,0 +1,68 @@
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=ts,import_extension=js"
2
+ // @generated from file tzero/v1/system/system.proto (package tzero.v1.system, syntax proto3)
3
+ /* eslint-disable */
4
+ import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
5
+ import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
6
+ import { file_buf_validate_validate } from "../../../buf/validate/validate_pb.js";
7
+ /**
8
+ * Describes the file tzero/v1/system/system.proto.
9
+ */
10
+ export const file_tzero_v1_system_system = /*@__PURE__*/ fileDesc("Chx0emVyby92MS9zeXN0ZW0vc3lzdGVtLnByb3RvEg90emVyby52MS5zeXN0ZW0iDwoNSGVhbHRoUmVxdWVzdCLKAQoOSGVhbHRoUmVzcG9uc2USHgoIc2VydmljZXMYCiADKAlCDLpICZIBBiIEcgIQARI4CgxjdXJyZW50X3RpbWUYFCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQga6SAPIAQESHAoLc2RrX3ZlcnNpb24YHiABKAlCB7pIBHICEAESQAoNc2RrX2Vjb3N5c3RlbRgoIAEoDjIdLnR6ZXJvLnYxLnN5c3RlbS5TZGtFY29zeXN0ZW1CCrpIB4IBBBABIAAqpwEKDFNka0Vjb3N5c3RlbRIdChlTREtfRUNPU1lTVEVNX1VOU1BFQ0lGSUVEEAASFAoQU0RLX0VDT1NZU1RFTV9HTxAKEhYKElNES19FQ09TWVNURU1fTk9ERRAUEhgKFFNES19FQ09TWVNURU1fUFlUSE9OEB4SFgoSU0RLX0VDT1NZU1RFTV9KQVZBECgSGAoUU0RLX0VDT1NZU1RFTV9DU0hBUlAQMjJfCg1TeXN0ZW1TZXJ2aWNlEk4KBkhlYWx0aBIeLnR6ZXJvLnYxLnN5c3RlbS5IZWFsdGhSZXF1ZXN0Gh8udHplcm8udjEuc3lzdGVtLkhlYWx0aFJlc3BvbnNlIgOQAgFCzwEKE2NvbS50emVyby52MS5zeXN0ZW1CC1N5c3RlbVByb3RvUAFaOmdpdGh1Yi5jb20vdC0wLW5ldHdvcmsvcHJvdmlkZXItc2RrL2dvL2FwaS90emVyby92MS9zeXN0ZW2iAgNUVlOqAiJUMC5Qcm92aWRlclNkay5BcGkuVHplcm8uVjEuU3lzdGVtygIPVHplcm9cVjFcU3lzdGVt4gIbVHplcm9cVjFcU3lzdGVtXEdQQk1ldGFkYXRh6gIRVHplcm86OlYxOjpTeXN0ZW1iBnByb3RvMw", [file_google_protobuf_timestamp, file_buf_validate_validate]);
11
+ /**
12
+ * Describes the message tzero.v1.system.HealthRequest.
13
+ * Use `create(HealthRequestSchema)` to create a new message.
14
+ */
15
+ export const HealthRequestSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_system_system, 0);
16
+ /**
17
+ * Describes the message tzero.v1.system.HealthResponse.
18
+ * Use `create(HealthResponseSchema)` to create a new message.
19
+ */
20
+ export const HealthResponseSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_system_system, 1);
21
+ /**
22
+ * @generated from enum tzero.v1.system.SdkEcosystem
23
+ */
24
+ export var SdkEcosystem;
25
+ (function (SdkEcosystem) {
26
+ /**
27
+ * @generated from enum value: SDK_ECOSYSTEM_UNSPECIFIED = 0;
28
+ */
29
+ SdkEcosystem[SdkEcosystem["UNSPECIFIED"] = 0] = "UNSPECIFIED";
30
+ /**
31
+ * @generated from enum value: SDK_ECOSYSTEM_GO = 10;
32
+ */
33
+ SdkEcosystem[SdkEcosystem["GO"] = 10] = "GO";
34
+ /**
35
+ * @generated from enum value: SDK_ECOSYSTEM_NODE = 20;
36
+ */
37
+ SdkEcosystem[SdkEcosystem["NODE"] = 20] = "NODE";
38
+ /**
39
+ * @generated from enum value: SDK_ECOSYSTEM_PYTHON = 30;
40
+ */
41
+ SdkEcosystem[SdkEcosystem["PYTHON"] = 30] = "PYTHON";
42
+ /**
43
+ * @generated from enum value: SDK_ECOSYSTEM_JAVA = 40;
44
+ */
45
+ SdkEcosystem[SdkEcosystem["JAVA"] = 40] = "JAVA";
46
+ /**
47
+ * @generated from enum value: SDK_ECOSYSTEM_CSHARP = 50;
48
+ */
49
+ SdkEcosystem[SdkEcosystem["CSHARP"] = 50] = "CSHARP";
50
+ })(SdkEcosystem || (SdkEcosystem = {}));
51
+ /**
52
+ * Describes the enum tzero.v1.system.SdkEcosystem.
53
+ */
54
+ export const SdkEcosystemSchema = /*@__PURE__*/ enumDesc(file_tzero_v1_system_system, 0);
55
+ /**
56
+ * *
57
+ * SystemService exposes operational/introspection RPCs on a provider
58
+ * endpoint. It is automatically registered by every provider SDK;
59
+ * customers do not implement it themselves. Calls are signed with the
60
+ * T-0 Network keypair, just like every other provider RPC.
61
+ *
62
+ * Health() is the first RPC. Future operational endpoints (e.g.
63
+ * Diagnostics, BuildInfo) belong on this service so customers continue
64
+ * to get them automatically as they upgrade the SDK.
65
+ *
66
+ * @generated from service tzero.v1.system.SystemService
67
+ */
68
+ export const SystemService = /*@__PURE__*/ serviceDesc(file_tzero_v1_system_system, 0);
@@ -2,6 +2,8 @@ import { Code, ConnectError, createContextKey, createContextValues } from "@conn
2
2
  import NetworkHeaders from "../common/headers.js";
3
3
  import { secp256k1 } from '@noble/curves/secp256k1.js';
4
4
  import { createValidationInterceptor } from "./validate_response.js";
5
+ import { SystemService } from "../common/gen/tzero/v1/system/system_pb.js";
6
+ import { createSystemServiceImpl } from "./system.js";
5
7
  export const REQUEST_VALIDITY_MILLIS = 60000;
6
8
  const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
7
9
  const ts = decodeNum(getHeader(req, NetworkHeaders.SignatureTimestamp));
@@ -40,7 +42,17 @@ export const createService = (networkPublicKey, registerRoutes) => {
40
42
  }
41
43
  return {
42
44
  routes: (router) => {
43
- registerRoutes(router);
45
+ const collected = [];
46
+ const origService = router.service.bind(router);
47
+ const wrappedRouter = {
48
+ service: (desc, impl) => {
49
+ collected.push(desc.typeName);
50
+ origService(desc, impl);
51
+ },
52
+ };
53
+ registerRoutes(wrappedRouter);
54
+ collected.push(SystemService.typeName);
55
+ origService(SystemService, createSystemServiceImpl(collected));
44
56
  },
45
57
  interceptors: [createSignatureVerification(networkPublicKey), createValidationInterceptor()],
46
58
  grpcWeb: false,
@@ -0,0 +1,4 @@
1
+ import { HealthRequest, HealthResponse } from "../common/gen/tzero/v1/system/system_pb.js";
2
+ export declare const createSystemServiceImpl: (services: string[]) => {
3
+ health(_req: HealthRequest): HealthResponse;
4
+ };
@@ -0,0 +1,14 @@
1
+ import { create } from "@bufbuild/protobuf";
2
+ import { timestampNow } from "@bufbuild/protobuf/wkt";
3
+ import { HealthResponseSchema, SdkEcosystem, } from "../common/gen/tzero/v1/system/system_pb.js";
4
+ import { SDK_VERSION } from "../version.js";
5
+ export const createSystemServiceImpl = (services) => ({
6
+ health(_req) {
7
+ return create(HealthResponseSchema, {
8
+ services,
9
+ currentTime: timestampNow(),
10
+ sdkVersion: SDK_VERSION,
11
+ sdkEcosystem: SdkEcosystem.NODE,
12
+ });
13
+ },
14
+ });
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "1.1.16";
@@ -0,0 +1,3 @@
1
+ // SDK semantic version. Bumped in lockstep with all other SDKs by the
2
+ // release.yaml workflow.
3
+ export const SDK_VERSION = "1.1.16";