Skip to content

Commit 7fd076b

Browse files
committed
feat: include leader public key when adding funds
1 parent c08c082 commit 7fd076b

40 files changed

+67
-38
lines changed

client-vms/src/gen-proto/nillion/auth/v1/public_key_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/auth/v1/public_key.proto (package nillion.auth.v1.public_key, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/auth/v1/token_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/auth/v1/token.proto (package nillion.auth.v1.token, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/auth/v1/user_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/auth/v1/user.proto (package nillion.auth.v1.user, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/compute/v1/invoke_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/compute/v1/invoke.proto (package nillion.compute.v1.invoke, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/compute/v1/retrieve_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/compute/v1/retrieve.proto (package nillion.compute.v1.retrieve, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/compute/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/compute/v1/service.proto (package nillion.compute.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/compute/v1/stream_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/compute/v1/stream.proto (package nillion.compute.v1.stream, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/leader_queries/v1/pool_status_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/leader_queries/v1/pool_status.proto (package nillion.leader_queries.v1.pool_status, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/leader_queries/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/leader_queries/v1/service.proto (package nillion.leader_queries.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/membership/v1/cluster_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/membership/v1/cluster.proto (package nillion.membership.v1.cluster, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/membership/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/membership/v1/service.proto (package nillion.membership.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/membership/v1/version_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/membership/v1/version.proto (package nillion.membership.v1.version, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/meta/v1/tx_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/meta/v1/tx.proto (package nillion.meta.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/payments/v1/balance_pb.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/payments/v1/balance.proto (package nillion.payments.v1.balance, syntax proto3)
33
/* eslint-disable */
44

@@ -8,13 +8,15 @@ import type { Timestamp } from "@bufbuild/protobuf/wkt";
88
import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
99
import type { UserId } from "../../auth/v1/user_pb";
1010
import { file_nillion_auth_v1_user } from "../../auth/v1/user_pb";
11+
import type { PublicKey } from "../../auth/v1/public_key_pb";
12+
import { file_nillion_auth_v1_public_key } from "../../auth/v1/public_key_pb";
1113
import type { Message } from "@bufbuild/protobuf";
1214

1315
/**
1416
* Describes the file nillion/payments/v1/balance.proto.
1517
*/
1618
export const file_nillion_payments_v1_balance: GenFile = /*@__PURE__*/
17-
fileDesc("CiFuaWxsaW9uL3BheW1lbnRzL3YxL2JhbGFuY2UucHJvdG8SG25pbGxpb24ucGF5bWVudHMudjEuYmFsYW5jZSKLAQoWQWNjb3VudEJhbGFuY2VSZXNwb25zZRIPCgdiYWxhbmNlGAEgASgEEjAKDGxhc3RfdXBkYXRlZBgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLgoKZXhwaXJlc19hdBgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiMwoPQWRkRnVuZHNSZXF1ZXN0Eg8KB3BheWxvYWQYASABKAwSDwoHdHhfaGFzaBgCIAEoCSJRCg9BZGRGdW5kc1BheWxvYWQSLwoJcmVjaXBpZW50GAEgASgLMhwubmlsbGlvbi5hdXRoLnYxLnVzZXIuVXNlcklkEg0KBW5vbmNlGAIgASgMQr8BCh9jb20ubmlsbGlvbi5wYXltZW50cy52MS5iYWxhbmNlQgxCYWxhbmNlUHJvdG9QAaICBE5QVkKqAhtOaWxsaW9uLlBheW1lbnRzLlYxLkJhbGFuY2XKAhtOaWxsaW9uXFBheW1lbnRzXFYxXEJhbGFuY2XiAidOaWxsaW9uXFBheW1lbnRzXFYxXEJhbGFuY2VcR1BCTWV0YWRhdGHqAh5OaWxsaW9uOjpQYXltZW50czo6VjE6OkJhbGFuY2ViBnByb3RvMw", [file_google_protobuf_timestamp, file_nillion_auth_v1_user]);
19+
fileDesc("CiFuaWxsaW9uL3BheW1lbnRzL3YxL2JhbGFuY2UucHJvdG8SG25pbGxpb24ucGF5bWVudHMudjEuYmFsYW5jZSKLAQoWQWNjb3VudEJhbGFuY2VSZXNwb25zZRIPCgdiYWxhbmNlGAEgASgEEjAKDGxhc3RfdXBkYXRlZBgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLgoKZXhwaXJlc19hdBgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiMwoPQWRkRnVuZHNSZXF1ZXN0Eg8KB3BheWxvYWQYASABKAwSDwoHdHhfaGFzaBgCIAEoCSKTAQoPQWRkRnVuZHNQYXlsb2FkEi8KCXJlY2lwaWVudBgBIAEoCzIcLm5pbGxpb24uYXV0aC52MS51c2VyLlVzZXJJZBINCgVub25jZRgCIAEoDBJAChFsZWFkZXJfcHVibGljX2tleRgDIAEoCzIlLm5pbGxpb24uYXV0aC52MS5wdWJsaWNfa2V5LlB1YmxpY0tleUK/AQofY29tLm5pbGxpb24ucGF5bWVudHMudjEuYmFsYW5jZUIMQmFsYW5jZVByb3RvUAGiAgROUFZCqgIbTmlsbGlvbi5QYXltZW50cy5WMS5CYWxhbmNlygIbTmlsbGlvblxQYXltZW50c1xWMVxCYWxhbmNl4gInTmlsbGlvblxQYXltZW50c1xWMVxCYWxhbmNlXEdQQk1ldGFkYXRh6gIeTmlsbGlvbjo6UGF5bWVudHM6OlYxOjpCYWxhbmNlYgZwcm90bzM", [file_google_protobuf_timestamp, file_nillion_auth_v1_user, file_nillion_auth_v1_public_key]);
1820

1921
/**
2022
* A response to a request to get the user account's balance.
@@ -98,6 +100,13 @@ export type AddFundsPayload = Message<"nillion.payments.v1.balance.AddFundsPaylo
98100
* @generated from field: bytes nonce = 2;
99101
*/
100102
nonce: Uint8Array;
103+
104+
/**
105+
* The public key of the leader node that funds are being sent to.
106+
*
107+
* @generated from field: nillion.auth.v1.public_key.PublicKey leader_public_key = 3;
108+
*/
109+
leaderPublicKey?: PublicKey;
101110
};
102111

103112
/**

client-vms/src/gen-proto/nillion/payments/v1/config_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/payments/v1/config.proto (package nillion.payments.v1.config, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/payments/v1/quote_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/payments/v1/quote.proto (package nillion.payments.v1.quote, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/payments/v1/receipt_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/payments/v1/receipt.proto (package nillion.payments.v1.receipt, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/payments/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/payments/v1/service.proto (package nillion.payments.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/permissions/v1/overwrite_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/permissions/v1/overwrite.proto (package nillion.permissions.v1.overwrite, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/permissions/v1/permissions_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/permissions/v1/permissions.proto (package nillion.permissions.v1.permissions, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/permissions/v1/retrieve_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/permissions/v1/retrieve.proto (package nillion.permissions.v1.retrieve, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/permissions/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/permissions/v1/service.proto (package nillion.permissions.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/permissions/v1/update_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/permissions/v1/update.proto (package nillion.permissions.v1.update, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/cleanup_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/cleanup.proto (package nillion.preprocessing.v1.cleanup, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/element_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/element.proto (package nillion.preprocessing.v1.element, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/generate_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/generate.proto (package nillion.preprocessing.v1.generate, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/material_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/material.proto (package nillion.preprocessing.v1.material, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/service.proto (package nillion.preprocessing.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/preprocessing/v1/stream_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/preprocessing/v1/stream.proto (package nillion.preprocessing.v1.stream, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/programs/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/programs/v1/service.proto (package nillion.programs.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/programs/v1/store_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/programs/v1/store.proto (package nillion.programs.v1.store, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/values/v1/delete_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/values/v1/delete.proto (package nillion.values.v1.delete, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/values/v1/retrieve_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/values/v1/retrieve.proto (package nillion.values.v1.retrieve, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/values/v1/service_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/values/v1/service.proto (package nillion.values.v1, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/values/v1/store_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/values/v1/store.proto (package nillion.values.v1.store, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/gen-proto/nillion/values/v1/value_pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
1+
// @generated by protoc-gen-es v2.2.3 with parameter "target=ts"
22
// @generated from file nillion/values/v1/value.proto (package nillion.values.v1.value, syntax proto3)
33
/* eslint-disable */
44

client-vms/src/payment/builder.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createClient } from "@connectrpc/connect";
22
import { type OfflineSigner, Registry } from "@cosmjs/proto-signing";
33
import { GasPrice, SigningStargateClient } from "@cosmjs/stargate";
44
import { z } from "zod";
5+
import type { PublicKey } from "#/gen-proto/nillion/auth/v1/public_key_pb";
56
import { Payments } from "#/gen-proto/nillion/payments/v1/service_pb";
67
import { UserId } from "#/types";
78
import { GrpcTransport, OfflineSignerSchema } from "#/types/grpc";
@@ -23,6 +24,7 @@ export class PaymentClientBuilder {
2324
private _transport?: GrpcTransport;
2425
private _id?: UserId;
2526
private _paymentMode?: PaymentMode;
27+
private _leaderPublicKey?: PublicKey;
2628

2729
chainUrl(url: string): this {
2830
this._chainUrl = url;
@@ -49,6 +51,11 @@ export class PaymentClientBuilder {
4951
return this;
5052
}
5153

54+
leaderPublicKey(publicKey: PublicKey): this {
55+
this._leaderPublicKey = publicKey;
56+
return this;
57+
}
58+
5259
async build(): Promise<PaymentClient> {
5360
const { signer, chainUrl, transport, id, paymentMode } =
5461
PaymentClientBuilderConfig.parse({
@@ -57,6 +64,7 @@ export class PaymentClientBuilder {
5764
transport: this._transport,
5865
id: this._id,
5966
paymentMode: this._paymentMode,
67+
leaderPublicKey: this._leaderPublicKey,
6068
});
6169

6270
const registry = new Registry();

client-vms/src/payment/client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { randomBytes } from "@noble/hashes/utils";
77
import { Effect as E, pipe } from "effect";
88
import { UnknownException } from "effect/Cause";
99
import { z } from "zod";
10+
import type { PublicKey } from "#/gen-proto/nillion/auth/v1/public_key_pb";
1011
import {
1112
type MsgPayFor,
1213
MsgPayForSchema,
@@ -51,6 +52,7 @@ export const PaymentClientConfig = z.object({
5152
),
5253
leader: GrpcClient,
5354
paymentMode: z.nativeEnum(PaymentMode),
55+
leaderPublicKey: z.custom<PublicKey>(),
5456
});
5557

5658
export type PaymentClientConfig = z.infer<typeof PaymentClientConfig>;
@@ -60,12 +62,14 @@ export class PaymentClient {
6062
private readonly chain: SigningStargateClient;
6163
private readonly leader: Client<typeof Payments>;
6264
private readonly paymentMode: PaymentMode;
65+
private readonly leaderPublicKey: PublicKey;
6366

6467
constructor(private readonly config: PaymentClientConfig) {
6568
this.address = config.address;
6669
this.chain = config.chain;
6770
this.leader = config.leader as Client<typeof Payments>;
6871
this.paymentMode = config.paymentMode;
72+
this.leaderPublicKey = config.leaderPublicKey;
6973
}
7074

7175
get id(): UserId {
@@ -213,6 +217,7 @@ export class PaymentClient {
213217
create(AddFundsPayloadSchema, {
214218
recipient: this.id.toProto(),
215219
nonce: randomBytes(32),
220+
leaderPublicKey: this.leaderPublicKey,
216221
}),
217222
);
218223
return pipe(

client-vms/src/vm/builder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,20 @@ export class VmClientBuilder {
196196
}
197197
}
198198

199+
if (
200+
!leaderClusterInfo.publicKeys ||
201+
!leaderClusterInfo.publicKeys.authentication
202+
)
203+
throw new Error("Leader public key not in cluster details");
204+
199205
const user_id = UserId.from(tokenAuthManager.publicKey);
200206
const payer = await new PaymentClientBuilder()
201207
.chainUrl(chainUrl)
202208
.paymentMode(supportedPaymentMode)
203209
.id(user_id)
204210
.signer(signer)
205211
.leader(leader.transport)
212+
.leaderPublicKey(leaderClusterInfo.publicKeys?.authentication)
206213
.build();
207214

208215
const config = VmClientConfig.parse({

0 commit comments

Comments
 (0)