@t-0/provider-sdk 1.0.23 → 1.0.24

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.
Files changed (38) hide show
  1. package/README.md +2 -2
  2. package/lib/client/client.d.ts +3 -33
  3. package/lib/client/client.js +4 -5
  4. package/lib/common/gen/tzero/v1/common/common_pb.d.ts +64 -0
  5. package/lib/common/gen/tzero/v1/common/common_pb.js +53 -0
  6. package/lib/common/gen/tzero/v1/common/payment_method_pb.d.ts +122 -0
  7. package/lib/common/gen/tzero/v1/common/payment_method_pb.js +57 -0
  8. package/lib/common/gen/tzero/v1/payment/network_pb.d.ts +567 -0
  9. package/lib/common/gen/tzero/v1/payment/network_pb.js +144 -0
  10. package/lib/common/gen/tzero/v1/payment/provider_pb.d.ts +641 -0
  11. package/lib/common/gen/tzero/v1/payment/provider_pb.js +203 -0
  12. package/lib/common/gen/tzero/v1/payment_intent/provider/provider_pb.d.ts +296 -0
  13. package/lib/common/gen/tzero/v1/payment_intent/provider/provider_pb.js +84 -0
  14. package/lib/common/gen/tzero/v1/payment_intent/recipient/recipient_pb.d.ts +214 -0
  15. package/lib/common/gen/tzero/v1/payment_intent/recipient/recipient_pb.js +59 -0
  16. package/lib/common/gen/tzero/v1/public/public_pb.d.ts +234 -0
  17. package/lib/common/gen/tzero/v1/public/public_pb.js +85 -0
  18. package/lib/gen/common/common_pb.d.ts +39 -1
  19. package/lib/gen/common/common_pb.js +42 -2
  20. package/lib/gen/common/payment_method_pb.d.ts +77 -6
  21. package/lib/gen/common/payment_method_pb.js +41 -2
  22. package/lib/gen/network/network_pb.d.ts +10 -98
  23. package/lib/gen/network/network_pb.js +2 -21
  24. package/lib/gen/network/provider_pb.d.ts +14 -99
  25. package/lib/gen/network/provider_pb.js +1 -21
  26. package/lib/gen/payment_intent/provider/provider_pb.d.ts +296 -0
  27. package/lib/gen/payment_intent/provider/provider_pb.js +84 -0
  28. package/lib/gen/payment_intent/recipient/recipient_pb.d.ts +214 -0
  29. package/lib/gen/payment_intent/recipient/recipient_pb.js +59 -0
  30. package/lib/index.d.ts +6 -4
  31. package/lib/index.js +6 -4
  32. package/lib/payment_intent/provider/index.d.ts +1 -0
  33. package/lib/payment_intent/provider/index.js +1 -0
  34. package/lib/payment_intent/recipient/index.d.ts +1 -0
  35. package/lib/payment_intent/recipient/index.js +1 -0
  36. package/lib/service/service.d.ts +6 -2
  37. package/lib/service/service.js +4 -6
  38. package/package.json +6 -6
package/README.md CHANGED
@@ -16,9 +16,9 @@ Usage instruction can be found in [NodeJS SDK docs](https://t-0-network.github.i
16
16
  ```
17
17
  3. Try using network client
18
18
  ```bash
19
- npx tsx examples/update-quote.ts
19
+ npx tsx src/examples/update-quote.ts
20
20
  ```
21
21
  4. Start dummy service implementation
22
22
  ```bash
23
- npx tsx examples/server.ts
23
+ npx tsx src/examples/server.ts
24
24
  ```
@@ -1,36 +1,6 @@
1
+ import { DescService } from "@bufbuild/protobuf";
1
2
  export declare const DEFAULT_ENDPOINT = "https://api.t-0.network";
2
- export declare function createNetworkClient(signer: string | Buffer | SignerFunction, endpoint?: string): import("@connectrpc/connect").Client<import("@bufbuild/protobuf/codegenv2").GenService<{
3
- updateQuote: {
4
- methodKind: "unary";
5
- input: typeof import("../common/gen/network/network_pb").UpdateQuoteRequestSchema;
6
- output: typeof import("../common/gen/network/network_pb").UpdateQuoteResponseSchema;
7
- };
8
- getPayoutQuote: {
9
- methodKind: "unary";
10
- input: typeof import("../common/gen/network/network_pb").GetPayoutQuoteRequestSchema;
11
- output: typeof import("../common/gen/network/network_pb").GetPayoutQuoteResponseSchema;
12
- };
13
- createPayment: {
14
- methodKind: "unary";
15
- input: typeof import("../common/gen/network/network_pb").CreatePaymentRequestSchema;
16
- output: typeof import("../common/gen/network/network_pb").CreatePaymentResponseSchema;
17
- };
18
- updatePayout: {
19
- methodKind: "unary";
20
- input: typeof import("../common/gen/network/network_pb").UpdatePayoutRequestSchema;
21
- output: typeof import("../common/gen/network/network_pb").UpdatePayoutResponseSchema;
22
- };
23
- createPayIn: {
24
- methodKind: "unary";
25
- input: typeof import("../common/gen/network/network_pb").CreatePayInRequestSchema;
26
- output: typeof import("../common/gen/network/network_pb").CreatePayInResponseSchema;
27
- };
28
- getKycData: {
29
- methodKind: "unary";
30
- input: typeof import("../common/gen/network/network_pb").GetKycDataRequestSchema;
31
- output: typeof import("../common/gen/network/network_pb").GetKycDataResponseSchema;
32
- };
33
- }>>;
3
+ export declare function createClient<T extends DescService>(signer: string | Buffer | ((data: Buffer) => Promise<Signature>) | Buffer<ArrayBufferLike>, endpoint: string | undefined, svc: T): import("@connectrpc/connect").Client<T>;
34
4
  /**
35
5
  * Signature with metadata for particular request
36
6
  */
@@ -43,4 +13,4 @@ export interface Signature {
43
13
  * with metadata
44
14
  */
45
15
  export type SignerFunction = (data: Buffer) => Promise<Signature>;
46
- export default createNetworkClient;
16
+ export default createClient;
@@ -1,11 +1,10 @@
1
- import { createClient } from "@connectrpc/connect";
1
+ import { createClient as createConnectClient } from "@connectrpc/connect";
2
2
  import { createConnectTransport } from "@connectrpc/connect-web";
3
3
  import { keccak_256 } from "@noble/hashes/sha3";
4
- import { NetworkService } from "../common/gen/network/network_pb";
5
4
  import CreateSigner from "./signer";
6
5
  import NetworkHeaders from "../common/headers";
7
6
  export const DEFAULT_ENDPOINT = "https://api.t-0.network";
8
- export function createNetworkClient(signer, endpoint) {
7
+ export function createClient(signer, endpoint, svc) {
9
8
  let customFetch;
10
9
  endpoint = endpoint || DEFAULT_ENDPOINT;
11
10
  if (typeof signer === "string" || Buffer.isBuffer(signer)) {
@@ -35,6 +34,6 @@ export function createNetworkClient(signer, endpoint) {
35
34
  baseUrl: endpoint || DEFAULT_ENDPOINT,
36
35
  fetch: customFetch,
37
36
  });
38
- return createClient(NetworkService, transport);
37
+ return createConnectClient(svc, transport);
39
38
  }
40
- export default createNetworkClient;
39
+ export default createClient;
@@ -0,0 +1,64 @@
1
+ import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Message } from "@bufbuild/protobuf";
3
+ /**
4
+ * Describes the file tzero/v1/common/common.proto.
5
+ */
6
+ export declare const file_tzero_v1_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>;
27
+ /**
28
+ * @generated from enum tzero.v1.common.Blockchain
29
+ */
30
+ export declare enum Blockchain {
31
+ /**
32
+ * @generated from enum value: BLOCKCHAIN_UNSPECIFIED = 0;
33
+ */
34
+ UNSPECIFIED = 0,
35
+ /**
36
+ * @generated from enum value: BLOCKCHAIN_BSC = 10;
37
+ */
38
+ BSC = 10,
39
+ /**
40
+ * @generated from enum value: BLOCKCHAIN_TRON = 100;
41
+ */
42
+ TRON = 100
43
+ }
44
+ /**
45
+ * Describes the enum tzero.v1.common.Blockchain.
46
+ */
47
+ export declare const BlockchainSchema: GenEnum<Blockchain>;
48
+ /**
49
+ * @generated from enum tzero.v1.common.Stablecoin
50
+ */
51
+ export declare enum Stablecoin {
52
+ /**
53
+ * @generated from enum value: STABLECOIN_UNSPECIFIED = 0;
54
+ */
55
+ UNSPECIFIED = 0,
56
+ /**
57
+ * @generated from enum value: STABLECOIN_USDT = 10;
58
+ */
59
+ USDT = 10
60
+ }
61
+ /**
62
+ * Describes the enum tzero.v1.common.Stablecoin.
63
+ */
64
+ export declare const StablecoinSchema: GenEnum<Stablecoin>;
@@ -0,0 +1,53 @@
1
+ // @generated by protoc-gen-es v2.6.2 with parameter "target=ts"
2
+ // @generated from file tzero/v1/common/common.proto (package tzero.v1.common, syntax proto3)
3
+ /* eslint-disable */
4
+ import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
+ /**
6
+ * Describes the file tzero/v1/common/common.proto.
7
+ */
8
+ export const file_tzero_v1_common_common = /*@__PURE__*/ fileDesc("Chx0emVyby92MS9jb21tb24vY29tbW9uLnByb3RvEg90emVyby52MS5jb21tb24iLQoHRGVjaW1hbBIQCgh1bnNjYWxlZBgKIAEoAxIQCghleHBvbmVudBgUIAEoBSpRCgpCbG9ja2NoYWluEhoKFkJMT0NLQ0hBSU5fVU5TUEVDSUZJRUQQABISCg5CTE9DS0NIQUlOX0JTQxAKEhMKD0JMT0NLQ0hBSU5fVFJPThBkKj0KClN0YWJsZWNvaW4SGgoWU1RBQkxFQ09JTl9VTlNQRUNJRklFRBAAEhMKD1NUQUJMRUNPSU5fVVNEVBAKQoABChNjb20udHplcm8udjEuY29tbW9uQgtDb21tb25Qcm90b1ABogIDVFZDqgIPVHplcm8uVjEuQ29tbW9uygIPVHplcm9cVjFcQ29tbW9u4gIbVHplcm9cVjFcQ29tbW9uXEdQQk1ldGFkYXRh6gIRVHplcm86OlYxOjpDb21tb25iBnByb3RvMw");
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_tzero_v1_common_common, 0);
14
+ /**
15
+ * @generated from enum tzero.v1.common.Blockchain
16
+ */
17
+ export var Blockchain;
18
+ (function (Blockchain) {
19
+ /**
20
+ * @generated from enum value: BLOCKCHAIN_UNSPECIFIED = 0;
21
+ */
22
+ Blockchain[Blockchain["UNSPECIFIED"] = 0] = "UNSPECIFIED";
23
+ /**
24
+ * @generated from enum value: BLOCKCHAIN_BSC = 10;
25
+ */
26
+ Blockchain[Blockchain["BSC"] = 10] = "BSC";
27
+ /**
28
+ * @generated from enum value: BLOCKCHAIN_TRON = 100;
29
+ */
30
+ Blockchain[Blockchain["TRON"] = 100] = "TRON";
31
+ })(Blockchain || (Blockchain = {}));
32
+ /**
33
+ * Describes the enum tzero.v1.common.Blockchain.
34
+ */
35
+ export const BlockchainSchema = /*@__PURE__*/ enumDesc(file_tzero_v1_common_common, 0);
36
+ /**
37
+ * @generated from enum tzero.v1.common.Stablecoin
38
+ */
39
+ export var Stablecoin;
40
+ (function (Stablecoin) {
41
+ /**
42
+ * @generated from enum value: STABLECOIN_UNSPECIFIED = 0;
43
+ */
44
+ Stablecoin[Stablecoin["UNSPECIFIED"] = 0] = "UNSPECIFIED";
45
+ /**
46
+ * @generated from enum value: STABLECOIN_USDT = 10;
47
+ */
48
+ Stablecoin[Stablecoin["USDT"] = 10] = "USDT";
49
+ })(Stablecoin || (Stablecoin = {}));
50
+ /**
51
+ * Describes the enum tzero.v1.common.Stablecoin.
52
+ */
53
+ export const StablecoinSchema = /*@__PURE__*/ enumDesc(file_tzero_v1_common_common, 1);
@@ -0,0 +1,122 @@
1
+ import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Blockchain, Stablecoin } from "./common_pb";
3
+ import type { Message } from "@bufbuild/protobuf";
4
+ /**
5
+ * Describes the file tzero/v1/common/payment_method.proto.
6
+ */
7
+ export declare const file_tzero_v1_common_payment_method: GenFile;
8
+ /**
9
+ * @generated from message tzero.v1.common.PaymentMethod
10
+ */
11
+ export type PaymentMethod = Message<"tzero.v1.common.PaymentMethod"> & {
12
+ /**
13
+ * @generated from oneof tzero.v1.common.PaymentMethod.details
14
+ */
15
+ details: {
16
+ /**
17
+ * @generated from field: tzero.v1.common.SepaPaymentMethod sepa = 10;
18
+ */
19
+ value: SepaPaymentMethod;
20
+ case: "sepa";
21
+ } | {
22
+ /**
23
+ * @generated from field: tzero.v1.common.SwiftPaymentMethod swift = 30;
24
+ */
25
+ value: SwiftPaymentMethod;
26
+ case: "swift";
27
+ } | {
28
+ /**
29
+ * @generated from field: tzero.v1.common.StablecoinPaymentMethod stablecoin = 40;
30
+ */
31
+ value: StablecoinPaymentMethod;
32
+ case: "stablecoin";
33
+ } | {
34
+ case: undefined;
35
+ value?: undefined;
36
+ };
37
+ };
38
+ /**
39
+ * Describes the message tzero.v1.common.PaymentMethod.
40
+ * Use `create(PaymentMethodSchema)` to create a new message.
41
+ */
42
+ export declare const PaymentMethodSchema: GenMessage<PaymentMethod>;
43
+ /**
44
+ * @generated from message tzero.v1.common.SepaPaymentMethod
45
+ */
46
+ export type SepaPaymentMethod = Message<"tzero.v1.common.SepaPaymentMethod"> & {
47
+ /**
48
+ * @generated from field: string iban = 20;
49
+ */
50
+ iban: string;
51
+ /**
52
+ * @generated from field: string beneficiary_name = 30;
53
+ */
54
+ beneficiaryName: string;
55
+ /**
56
+ * @generated from field: string payment_reference = 40;
57
+ */
58
+ paymentReference: string;
59
+ };
60
+ /**
61
+ * Describes the message tzero.v1.common.SepaPaymentMethod.
62
+ * Use `create(SepaPaymentMethodSchema)` to create a new message.
63
+ */
64
+ export declare const SepaPaymentMethodSchema: GenMessage<SepaPaymentMethod>;
65
+ /**
66
+ * @generated from message tzero.v1.common.SwiftPaymentMethod
67
+ */
68
+ export type SwiftPaymentMethod = Message<"tzero.v1.common.SwiftPaymentMethod"> & {};
69
+ /**
70
+ * Describes the message tzero.v1.common.SwiftPaymentMethod.
71
+ * Use `create(SwiftPaymentMethodSchema)` to create a new message.
72
+ */
73
+ export declare const SwiftPaymentMethodSchema: GenMessage<SwiftPaymentMethod>;
74
+ /**
75
+ * @generated from message tzero.v1.common.StablecoinPaymentMethod
76
+ */
77
+ export type StablecoinPaymentMethod = Message<"tzero.v1.common.StablecoinPaymentMethod"> & {
78
+ /**
79
+ * @generated from field: tzero.v1.common.Blockchain blockchain = 10;
80
+ */
81
+ blockchain: Blockchain;
82
+ /**
83
+ * @generated from field: tzero.v1.common.Stablecoin stablecoin = 20;
84
+ */
85
+ stablecoin: Stablecoin;
86
+ /**
87
+ * @generated from field: string address = 30;
88
+ */
89
+ address: string;
90
+ };
91
+ /**
92
+ * Describes the message tzero.v1.common.StablecoinPaymentMethod.
93
+ * Use `create(StablecoinPaymentMethodSchema)` to create a new message.
94
+ */
95
+ export declare const StablecoinPaymentMethodSchema: GenMessage<StablecoinPaymentMethod>;
96
+ /**
97
+ * @generated from enum tzero.v1.common.PaymentMethodType
98
+ */
99
+ export declare enum PaymentMethodType {
100
+ /**
101
+ * @generated from enum value: PAYMENT_METHOD_TYPE_UNSPECIFIED = 0;
102
+ */
103
+ UNSPECIFIED = 0,
104
+ /**
105
+ * @generated from enum value: PAYMENT_METHOD_TYPE_SEPA = 10;
106
+ */
107
+ SEPA = 10,
108
+ /**
109
+ * @generated from enum value: PAYMENT_METHOD_TYPE_SWIFT = 20;
110
+ */
111
+ SWIFT = 20,
112
+ /**
113
+ * only pay in
114
+ *
115
+ * @generated from enum value: PAYMENT_METHOD_TYPE_CARD = 30;
116
+ */
117
+ CARD = 30
118
+ }
119
+ /**
120
+ * Describes the enum tzero.v1.common.PaymentMethodType.
121
+ */
122
+ export declare const PaymentMethodTypeSchema: GenEnum<PaymentMethodType>;
@@ -0,0 +1,57 @@
1
+ // @generated by protoc-gen-es v2.6.2 with parameter "target=ts"
2
+ // @generated from file tzero/v1/common/payment_method.proto (package tzero.v1.common, syntax proto3)
3
+ /* eslint-disable */
4
+ import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
+ import { file_tzero_v1_common_common } from "./common_pb";
6
+ /**
7
+ * Describes the file tzero/v1/common/payment_method.proto.
8
+ */
9
+ export const file_tzero_v1_common_payment_method = /*@__PURE__*/ fileDesc("CiR0emVyby92MS9jb21tb24vcGF5bWVudF9tZXRob2QucHJvdG8SD3R6ZXJvLnYxLmNvbW1vbiLEAQoNUGF5bWVudE1ldGhvZBIyCgRzZXBhGAogASgLMiIudHplcm8udjEuY29tbW9uLlNlcGFQYXltZW50TWV0aG9kSAASNAoFc3dpZnQYHiABKAsyIy50emVyby52MS5jb21tb24uU3dpZnRQYXltZW50TWV0aG9kSAASPgoKc3RhYmxlY29pbhgoIAEoCzIoLnR6ZXJvLnYxLmNvbW1vbi5TdGFibGVjb2luUGF5bWVudE1ldGhvZEgAQgkKB2RldGFpbHMiVgoRU2VwYVBheW1lbnRNZXRob2QSDAoEaWJhbhgUIAEoCRIYChBiZW5lZmljaWFyeV9uYW1lGB4gASgJEhkKEXBheW1lbnRfcmVmZXJlbmNlGCggASgJIhQKElN3aWZ0UGF5bWVudE1ldGhvZCKMAQoXU3RhYmxlY29pblBheW1lbnRNZXRob2QSLwoKYmxvY2tjaGFpbhgKIAEoDjIbLnR6ZXJvLnYxLmNvbW1vbi5CbG9ja2NoYWluEi8KCnN0YWJsZWNvaW4YFCABKA4yGy50emVyby52MS5jb21tb24uU3RhYmxlY29pbhIPCgdhZGRyZXNzGB4gASgJKpMBChFQYXltZW50TWV0aG9kVHlwZRIjCh9QQVlNRU5UX01FVEhPRF9UWVBFX1VOU1BFQ0lGSUVEEAASHAoYUEFZTUVOVF9NRVRIT0RfVFlQRV9TRVBBEAoSHQoZUEFZTUVOVF9NRVRIT0RfVFlQRV9TV0lGVBAUEhwKGFBBWU1FTlRfTUVUSE9EX1RZUEVfQ0FSRBAeQocBChNjb20udHplcm8udjEuY29tbW9uQhJQYXltZW50TWV0aG9kUHJvdG9QAaICA1RWQ6oCD1R6ZXJvLlYxLkNvbW1vbsoCD1R6ZXJvXFYxXENvbW1vbuICG1R6ZXJvXFYxXENvbW1vblxHUEJNZXRhZGF0YeoCEVR6ZXJvOjpWMTo6Q29tbW9uYgZwcm90bzM", [file_tzero_v1_common_common]);
10
+ /**
11
+ * Describes the message tzero.v1.common.PaymentMethod.
12
+ * Use `create(PaymentMethodSchema)` to create a new message.
13
+ */
14
+ export const PaymentMethodSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_common_payment_method, 0);
15
+ /**
16
+ * Describes the message tzero.v1.common.SepaPaymentMethod.
17
+ * Use `create(SepaPaymentMethodSchema)` to create a new message.
18
+ */
19
+ export const SepaPaymentMethodSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_common_payment_method, 1);
20
+ /**
21
+ * Describes the message tzero.v1.common.SwiftPaymentMethod.
22
+ * Use `create(SwiftPaymentMethodSchema)` to create a new message.
23
+ */
24
+ export const SwiftPaymentMethodSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_common_payment_method, 2);
25
+ /**
26
+ * Describes the message tzero.v1.common.StablecoinPaymentMethod.
27
+ * Use `create(StablecoinPaymentMethodSchema)` to create a new message.
28
+ */
29
+ export const StablecoinPaymentMethodSchema = /*@__PURE__*/ messageDesc(file_tzero_v1_common_payment_method, 3);
30
+ /**
31
+ * @generated from enum tzero.v1.common.PaymentMethodType
32
+ */
33
+ export var PaymentMethodType;
34
+ (function (PaymentMethodType) {
35
+ /**
36
+ * @generated from enum value: PAYMENT_METHOD_TYPE_UNSPECIFIED = 0;
37
+ */
38
+ PaymentMethodType[PaymentMethodType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
39
+ /**
40
+ * @generated from enum value: PAYMENT_METHOD_TYPE_SEPA = 10;
41
+ */
42
+ PaymentMethodType[PaymentMethodType["SEPA"] = 10] = "SEPA";
43
+ /**
44
+ * @generated from enum value: PAYMENT_METHOD_TYPE_SWIFT = 20;
45
+ */
46
+ PaymentMethodType[PaymentMethodType["SWIFT"] = 20] = "SWIFT";
47
+ /**
48
+ * only pay in
49
+ *
50
+ * @generated from enum value: PAYMENT_METHOD_TYPE_CARD = 30;
51
+ */
52
+ PaymentMethodType[PaymentMethodType["CARD"] = 30] = "CARD";
53
+ })(PaymentMethodType || (PaymentMethodType = {}));
54
+ /**
55
+ * Describes the enum tzero.v1.common.PaymentMethodType.
56
+ */
57
+ export const PaymentMethodTypeSchema = /*@__PURE__*/ enumDesc(file_tzero_v1_common_payment_method, 0);