@t-0/provider-sdk 1.0.23 → 1.0.25
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 +2 -2
- package/lib/client/client.d.ts +3 -33
- package/lib/client/client.js +6 -7
- package/lib/client/signer.d.ts +1 -1
- package/lib/common/gen/tzero/v1/common/common_pb.d.ts +64 -0
- package/lib/common/gen/tzero/v1/common/common_pb.js +53 -0
- package/lib/common/gen/tzero/v1/common/payment_method_pb.d.ts +122 -0
- package/lib/common/gen/tzero/v1/common/payment_method_pb.js +57 -0
- package/lib/{gen/network → common/gen/tzero/v1/payment}/network_pb.d.ts +95 -183
- package/lib/common/gen/tzero/v1/payment/network_pb.js +144 -0
- package/lib/{gen/network → common/gen/tzero/v1/payment}/provider_pb.d.ts +98 -183
- package/lib/common/gen/tzero/v1/payment/provider_pb.js +203 -0
- package/lib/common/gen/tzero/v1/payment_intent/provider/provider_pb.d.ts +296 -0
- package/lib/common/gen/tzero/v1/payment_intent/provider/provider_pb.js +84 -0
- package/lib/common/gen/tzero/v1/payment_intent/recipient/recipient_pb.d.ts +214 -0
- package/lib/common/gen/tzero/v1/payment_intent/recipient/recipient_pb.js +59 -0
- package/lib/common/gen/tzero/v1/public/public_pb.d.ts +234 -0
- package/lib/common/gen/tzero/v1/public/public_pb.js +85 -0
- package/lib/index.d.ts +9 -7
- package/lib/index.js +9 -7
- package/lib/payment_intent/provider/index.d.ts +1 -0
- package/lib/payment_intent/provider/index.js +1 -0
- package/lib/payment_intent/recipient/index.d.ts +1 -0
- package/lib/payment_intent/recipient/index.js +1 -0
- package/lib/service/node.d.ts +2 -1
- package/lib/service/service.d.ts +8 -5
- package/lib/service/service.js +5 -7
- package/package.json +9 -9
- package/lib/common/gen/common/common_pb.d.ts +0 -26
- package/lib/common/gen/common/common_pb.js +0 -13
- package/lib/common/gen/common/payment_method_pb.d.ts +0 -51
- package/lib/common/gen/common/payment_method_pb.js +0 -18
- package/lib/common/gen/network/network_pb.d.ts +0 -649
- package/lib/common/gen/network/network_pb.js +0 -163
- package/lib/common/gen/network/provider_pb.d.ts +0 -695
- package/lib/common/gen/network/provider_pb.js +0 -218
- package/lib/gen/common/common_pb.d.ts +0 -26
- package/lib/gen/common/common_pb.js +0 -13
- package/lib/gen/common/payment_method_pb.d.ts +0 -51
- package/lib/gen/common/payment_method_pb.js +0 -18
- package/lib/gen/network/network_pb.js +0 -163
- package/lib/gen/network/provider_pb.js +0 -223
package/lib/service/service.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ConnectRouter } from "@connectrpc/connect";
|
|
2
|
-
import { ProviderService } from "../common/gen/network/provider_pb";
|
|
3
|
-
import type { ServiceImpl } from "@connectrpc/connect/dist/esm/implementation";
|
|
4
2
|
import type { Interceptor } from "@connectrpc/connect";
|
|
5
|
-
import {
|
|
3
|
+
import type { DescService } from "@bufbuild/protobuf";
|
|
4
|
+
import type { ServiceImpl } from "@connectrpc/connect";
|
|
6
5
|
export declare const REQUEST_VALIDITY_MILLIS = 60000;
|
|
7
|
-
|
|
6
|
+
interface Router {
|
|
7
|
+
service: <T extends DescService>(service: T, implementation: Partial<ServiceImpl<T>>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const createService: (networkPublicKey: string | Buffer, registerRoutes: (router: Router) => void) => {
|
|
8
10
|
routes: (router: ConnectRouter) => void;
|
|
9
11
|
interceptors: Interceptor[];
|
|
10
12
|
grpcWeb: boolean;
|
|
11
|
-
contextValues: (req:
|
|
13
|
+
contextValues: (req: any) => import("@connectrpc/connect").ContextValues;
|
|
12
14
|
};
|
|
15
|
+
export {};
|
package/lib/service/service.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Code, ConnectError, createContextKey, createContextValues } from "@connectrpc/connect";
|
|
2
|
-
import
|
|
3
|
-
import NetworkHeaders from "../common/headers";
|
|
2
|
+
import NetworkHeaders from "../common/headers.js";
|
|
4
3
|
import * as secp from '@noble/secp256k1';
|
|
5
4
|
export const REQUEST_VALIDITY_MILLIS = 60_000;
|
|
6
|
-
const createRoutes = (service) => (router) => {
|
|
7
|
-
router.service(ProviderService, service);
|
|
8
|
-
};
|
|
9
5
|
const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
|
|
10
6
|
const ts = decodeNum(getHeader(req, NetworkHeaders.SignatureTimestamp));
|
|
11
7
|
if (Date.now() - ts > 60_000) {
|
|
@@ -34,12 +30,14 @@ const createSignatureVerification = (networkPublicKey) => (next) => async (req)
|
|
|
34
30
|
}
|
|
35
31
|
return await next(req);
|
|
36
32
|
};
|
|
37
|
-
export const createService = (networkPublicKey,
|
|
33
|
+
export const createService = (networkPublicKey, registerRoutes) => {
|
|
38
34
|
if (typeof networkPublicKey == "string") {
|
|
39
35
|
networkPublicKey = decodeHex(networkPublicKey);
|
|
40
36
|
}
|
|
41
37
|
return {
|
|
42
|
-
routes:
|
|
38
|
+
routes: (router) => {
|
|
39
|
+
registerRoutes(router);
|
|
40
|
+
},
|
|
43
41
|
interceptors: [createSignatureVerification(networkPublicKey)],
|
|
44
42
|
grpcWeb: false,
|
|
45
43
|
contextValues: (req) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t-0/provider-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "Provider SDK for the T-0 Network",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@bufbuild/protobuf": "^2.6.
|
|
27
|
-
"@connectrpc/connect": "^2.0.
|
|
28
|
-
"@connectrpc/connect-web": "^2.0.
|
|
29
|
-
"@connectrpc/connect-node": "^2.0.
|
|
26
|
+
"@bufbuild/protobuf": "^2.6.2",
|
|
27
|
+
"@connectrpc/connect": "^2.0.3",
|
|
28
|
+
"@connectrpc/connect-web": "^2.0.3",
|
|
29
|
+
"@connectrpc/connect-node": "^2.0.3",
|
|
30
30
|
"@noble/hashes": "^1.8.0",
|
|
31
31
|
"@noble/secp256k1": "^2.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@bufbuild/protoc-gen-es": "^2.6.
|
|
35
|
-
"@types/node": "^24.0
|
|
36
|
-
"dotenv": "^17.
|
|
34
|
+
"@bufbuild/protoc-gen-es": "^2.6.2",
|
|
35
|
+
"@types/node": "^24.1.0",
|
|
36
|
+
"dotenv": "^17.2.1",
|
|
37
37
|
"tsx": "^4.20.3",
|
|
38
|
-
"typescript": "^5.
|
|
38
|
+
"typescript": "^5.9.2"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"buf:generate": "buf generate",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
-
/**
|
|
4
|
-
* Describes the file common/common.proto.
|
|
5
|
-
*/
|
|
6
|
-
export declare const file_common_common: GenFile;
|
|
7
|
-
/**
|
|
8
|
-
* Decimal 123.45 equals to unscaled=12345 and exponent=-2 (e.g. unscaled * 10^exponent, 123.45 = 12345 * 10^-2)
|
|
9
|
-
*
|
|
10
|
-
* @generated from message tzero.v1.common.Decimal
|
|
11
|
-
*/
|
|
12
|
-
export type Decimal = Message<"tzero.v1.common.Decimal"> & {
|
|
13
|
-
/**
|
|
14
|
-
* @generated from field: int64 unscaled = 10;
|
|
15
|
-
*/
|
|
16
|
-
unscaled: bigint;
|
|
17
|
-
/**
|
|
18
|
-
* @generated from field: int32 exponent = 20;
|
|
19
|
-
*/
|
|
20
|
-
exponent: number;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Describes the message tzero.v1.common.Decimal.
|
|
24
|
-
* Use `create(DecimalSchema)` to create a new message.
|
|
25
|
-
*/
|
|
26
|
-
export declare const DecimalSchema: GenMessage<Decimal>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v2.6.0 with parameter "target=ts"
|
|
2
|
-
// @generated from file common/common.proto (package tzero.v1.common, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
5
|
-
/**
|
|
6
|
-
* Describes the file common/common.proto.
|
|
7
|
-
*/
|
|
8
|
-
export const file_common_common = /*@__PURE__*/ fileDesc("ChNjb21tb24vY29tbW9uLnByb3RvEg90emVyby52MS5jb21tb24iLQoHRGVjaW1hbBIQCgh1bnNjYWxlZBgKIAEoAxIQCghleHBvbmVudBgUIAEoBUKAAQoTY29tLnR6ZXJvLnYxLmNvbW1vbkILQ29tbW9uUHJvdG9QAaICA1RWQ6oCD1R6ZXJvLlYxLkNvbW1vbsoCD1R6ZXJvXFYxXENvbW1vbuICG1R6ZXJvXFYxXENvbW1vblxHUEJNZXRhZGF0YeoCEVR6ZXJvOjpWMTo6Q29tbW9uYgZwcm90bzM");
|
|
9
|
-
/**
|
|
10
|
-
* Describes the message tzero.v1.common.Decimal.
|
|
11
|
-
* Use `create(DecimalSchema)` to create a new message.
|
|
12
|
-
*/
|
|
13
|
-
export const DecimalSchema = /*@__PURE__*/ messageDesc(file_common_common, 0);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
-
/**
|
|
4
|
-
* Describes the file common/payment_method.proto.
|
|
5
|
-
*/
|
|
6
|
-
export declare const file_common_payment_method: GenFile;
|
|
7
|
-
/**
|
|
8
|
-
* @generated from message tzero.v1.common.PaymentMethod
|
|
9
|
-
*/
|
|
10
|
-
export type PaymentMethod = Message<"tzero.v1.common.PaymentMethod"> & {
|
|
11
|
-
/**
|
|
12
|
-
* @generated from oneof tzero.v1.common.PaymentMethod.details
|
|
13
|
-
*/
|
|
14
|
-
details: {
|
|
15
|
-
/**
|
|
16
|
-
* @generated from field: tzero.v1.common.SepaPaymentMethod sepa = 10;
|
|
17
|
-
*/
|
|
18
|
-
value: SepaPaymentMethod;
|
|
19
|
-
case: "sepa";
|
|
20
|
-
} | {
|
|
21
|
-
case: undefined;
|
|
22
|
-
value?: undefined;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Describes the message tzero.v1.common.PaymentMethod.
|
|
27
|
-
* Use `create(PaymentMethodSchema)` to create a new message.
|
|
28
|
-
*/
|
|
29
|
-
export declare const PaymentMethodSchema: GenMessage<PaymentMethod>;
|
|
30
|
-
/**
|
|
31
|
-
* @generated from message tzero.v1.common.SepaPaymentMethod
|
|
32
|
-
*/
|
|
33
|
-
export type SepaPaymentMethod = Message<"tzero.v1.common.SepaPaymentMethod"> & {
|
|
34
|
-
/**
|
|
35
|
-
* @generated from field: string iban = 10;
|
|
36
|
-
*/
|
|
37
|
-
iban: string;
|
|
38
|
-
/**
|
|
39
|
-
* @generated from field: string payment_reference = 20;
|
|
40
|
-
*/
|
|
41
|
-
paymentReference: string;
|
|
42
|
-
/**
|
|
43
|
-
* @generated from field: string name = 30;
|
|
44
|
-
*/
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Describes the message tzero.v1.common.SepaPaymentMethod.
|
|
49
|
-
* Use `create(SepaPaymentMethodSchema)` to create a new message.
|
|
50
|
-
*/
|
|
51
|
-
export declare const SepaPaymentMethodSchema: GenMessage<SepaPaymentMethod>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v2.6.0 with parameter "target=ts"
|
|
2
|
-
// @generated from file common/payment_method.proto (package tzero.v1.common, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
5
|
-
/**
|
|
6
|
-
* Describes the file common/payment_method.proto.
|
|
7
|
-
*/
|
|
8
|
-
export const file_common_payment_method = /*@__PURE__*/ fileDesc("Chtjb21tb24vcGF5bWVudF9tZXRob2QucHJvdG8SD3R6ZXJvLnYxLmNvbW1vbiJOCg1QYXltZW50TWV0aG9kEjIKBHNlcGEYCiABKAsyIi50emVyby52MS5jb21tb24uU2VwYVBheW1lbnRNZXRob2RIAEIJCgdkZXRhaWxzIkoKEVNlcGFQYXltZW50TWV0aG9kEgwKBGliYW4YCiABKAkSGQoRcGF5bWVudF9yZWZlcmVuY2UYFCABKAkSDAoEbmFtZRgeIAEoCUKHAQoTY29tLnR6ZXJvLnYxLmNvbW1vbkISUGF5bWVudE1ldGhvZFByb3RvUAGiAgNUVkOqAg9UemVyby5WMS5Db21tb27KAg9UemVyb1xWMVxDb21tb27iAhtUemVyb1xWMVxDb21tb25cR1BCTWV0YWRhdGHqAhFUemVybzo6VjE6OkNvbW1vbmIGcHJvdG8z");
|
|
9
|
-
/**
|
|
10
|
-
* Describes the message tzero.v1.common.PaymentMethod.
|
|
11
|
-
* Use `create(PaymentMethodSchema)` to create a new message.
|
|
12
|
-
*/
|
|
13
|
-
export const PaymentMethodSchema = /*@__PURE__*/ messageDesc(file_common_payment_method, 0);
|
|
14
|
-
/**
|
|
15
|
-
* Describes the message tzero.v1.common.SepaPaymentMethod.
|
|
16
|
-
* Use `create(SepaPaymentMethodSchema)` to create a new message.
|
|
17
|
-
*/
|
|
18
|
-
export const SepaPaymentMethodSchema = /*@__PURE__*/ messageDesc(file_common_payment_method, 1);
|