Skip to content

Commit cecbbd0

Browse files
authored
Merge pull request #3 from code-payments/payments-with-relationship-accounts
Integrate relationship accounts more broadly into payment flows
2 parents a040e28 + 7246ff3 commit cecbbd0

File tree

8 files changed

+924
-838
lines changed

8 files changed

+924
-838
lines changed

generated/go/account/v1/account_service.pb.go

Lines changed: 84 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/go/account/v1/account_service.pb.validate.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/go/transaction/v2/transaction_service.pb.go

Lines changed: 772 additions & 754 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/go/transaction/v2/transaction_service.pb.validate.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/protobuf-es/account/v1/account_service_pb.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
77
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
8-
import { AccountType, Signature, SolanaAccountId } from "../../common/v1/model_pb";
8+
import { AccountType, Relationship, Signature, SolanaAccountId } from "../../common/v1/model_pb";
99
import { ExchangeData } from "../../transaction/v2/transaction_service_pb";
1010

1111
/**
@@ -366,6 +366,14 @@ export class TokenAccountInfo extends Message<TokenAccountInfo> {
366366
*/
367367
mintDisplayName = "";
368368

369+
/**
370+
* The relationship with a third party that this account has established with.
371+
* This only applies to relevant account types (eg. RELATIONSHIP).
372+
*
373+
* @generated from field: code.common.v1.Relationship relationship = 16;
374+
*/
375+
relationship?: Relationship;
376+
369377
constructor(data?: PartialMessage<TokenAccountInfo>) {
370378
super();
371379
proto3.util.initPartial(data, this);
@@ -389,6 +397,7 @@ export class TokenAccountInfo extends Message<TokenAccountInfo> {
389397
{ no: 13, name: "mint", kind: "message", T: SolanaAccountId },
390398
{ no: 14, name: "mint_decimals", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
391399
{ no: 15, name: "mint_display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
400+
{ no: 16, name: "relationship", kind: "message", T: Relationship },
392401
]);
393402

394403
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TokenAccountInfo {

generated/protobuf-es/transaction/v2/transaction_service_pb.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,11 +1697,21 @@ export class SendPrivatePaymentMetadata extends Message<SendPrivatePaymentMetada
16971697
*
16981698
* Action Spec:
16991699
*
1700-
* actions = [NoPrivacyTransferAction(PRIMARY, destination, ExchangeData.Quarks)]
1700+
* source = PRIMARY or RELATIONSHIP
1701+
* actions = [NoPrivacyTransferAction(source, destination, ExchangeData.Quarks)]
17011702
*
17021703
* @generated from message code.transaction.v2.SendPublicPaymentMetadata
17031704
*/
17041705
export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata> {
1706+
/**
1707+
* The primary or relatinship account where funds will be sent from. The primary
1708+
* account is assumed if this field is not set for backwards compatibility with
1709+
* old clients.
1710+
*
1711+
* @generated from field: code.common.v1.SolanaAccountId source = 4;
1712+
*/
1713+
source?: SolanaAccountId;
1714+
17051715
/**
17061716
* The destination token account to send funds to. This cannot be a Code
17071717
* temporary account.
@@ -1732,6 +1742,7 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17321742
static readonly runtime: typeof proto3 = proto3;
17331743
static readonly typeName = "code.transaction.v2.SendPublicPaymentMetadata";
17341744
static readonly fields: FieldList = proto3.util.newFieldList(() => [
1745+
{ no: 4, name: "source", kind: "message", T: SolanaAccountId },
17351746
{ no: 1, name: "destination", kind: "message", T: SolanaAccountId },
17361747
{ no: 2, name: "exchange_data", kind: "message", T: ExchangeData },
17371748
{ no: 3, name: "is_withdrawal", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
@@ -1781,19 +1792,20 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17811792
*
17821793
* Action Spec (Deposit):
17831794
*
1795+
* source = PRIMARY or RELATIONSHIP
17841796
* actions = [
1785-
* TemporaryPrivacyTransferAction(PRIMARY, BUCKET_X_KIN, multiple * bucketSize),
1797+
* TemporaryPrivacyTransferAction(source, BUCKET_X_KIN, multiple * bucketSize),
17861798
* TemporaryPrivacyExchangeAction(BUCKET_X_KIN, BUCKET_X_KIN, multiple * bucketSize),
17871799
* ...,
1788-
* TemporaryPrivacyTransferAction(PRIMARY, BUCKET_X_KIN, multiple * bucketSize),
1800+
* TemporaryPrivacyTransferAction(source, BUCKET_X_KIN, multiple * bucketSize),
17891801
* TemporaryPrivacyExchangeAction(BUCKET_X_KIN, BUCKET_X_KIN, multiple * bucketSize),
17901802
* ]
17911803
*
17921804
* @generated from message code.transaction.v2.ReceivePaymentsPrivatelyMetadata
17931805
*/
17941806
export class ReceivePaymentsPrivatelyMetadata extends Message<ReceivePaymentsPrivatelyMetadata> {
17951807
/**
1796-
* The temporary incoming or primary account to receive funds from
1808+
* The temporary incoming, primary or relationship account to receive funds from
17971809
*
17981810
* @generated from field: code.common.v1.SolanaAccountId source = 1;
17991811
*/
@@ -1807,9 +1819,9 @@ export class ReceivePaymentsPrivatelyMetadata extends Message<ReceivePaymentsPri
18071819
quarks = protoInt64.zero;
18081820

18091821
/**
1810-
* Is the receipt of funds from a deposti? If true, the source account must
1811-
* be the primary account. Otherwise, it must be from a temporary incoming
1812-
* account.
1822+
* Is the receipt of funds from a deposit? If true, the source account must
1823+
* be a primary or relationship account. Otherwise, it must be from a temporary
1824+
* incoming account.
18131825
*
18141826
* @generated from field: bool is_deposit = 3;
18151827
*/

proto/account/v1/account_service.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,8 @@ message TokenAccountInfo {
182182

183183
// User-friendly display name for the mint
184184
string mint_display_name = 15 [(validate.rules).string.max_len = 32];
185+
186+
// The relationship with a third party that this account has established with.
187+
// This only applies to relevant account types (eg. RELATIONSHIP).
188+
common.v1.Relationship relationship = 16;
185189
}

proto/transaction/v2/transaction_service.proto

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,14 @@ message SendPrivatePaymentMetadata {
504504
//
505505
// Action Spec:
506506
//
507-
// actions = [NoPrivacyTransferAction(PRIMARY, destination, ExchangeData.Quarks)]
507+
// source = PRIMARY or RELATIONSHIP
508+
// actions = [NoPrivacyTransferAction(source, destination, ExchangeData.Quarks)]
508509
message SendPublicPaymentMetadata {
510+
// The primary or relatinship account where funds will be sent from. The primary
511+
// account is assumed if this field is not set for backwards compatibility with
512+
// old clients.
513+
common.v1.SolanaAccountId source = 4;
514+
509515
// The destination token account to send funds to. This cannot be a Code
510516
// temporary account.
511517
common.v1.SolanaAccountId destination = 1 [(validate.rules).message.required = true];
@@ -514,7 +520,7 @@ message SendPublicPaymentMetadata {
514520
ExchangeData exchange_data = 2 [(validate.rules).message.required = true];
515521

516522
// Is the payment a withdrawal? Currently, this is always true.
517-
bool is_withdrawal = 3 [(validate.rules).bool.const = true];;
523+
bool is_withdrawal = 3 [(validate.rules).bool.const = true];
518524
}
519525

520526
// Receive funds into an organizer with initial temporary privacy. Clients should
@@ -543,23 +549,24 @@ message SendPublicPaymentMetadata {
543549
//
544550
// Action Spec (Deposit):
545551
//
552+
// source = PRIMARY or RELATIONSHIP
546553
// actions = [
547-
// TemporaryPrivacyTransferAction(PRIMARY, BUCKET_X_KIN, multiple * bucketSize),
554+
// TemporaryPrivacyTransferAction(source, BUCKET_X_KIN, multiple * bucketSize),
548555
// TemporaryPrivacyExchangeAction(BUCKET_X_KIN, BUCKET_X_KIN, multiple * bucketSize),
549556
// ...,
550-
// TemporaryPrivacyTransferAction(PRIMARY, BUCKET_X_KIN, multiple * bucketSize),
557+
// TemporaryPrivacyTransferAction(source, BUCKET_X_KIN, multiple * bucketSize),
551558
// TemporaryPrivacyExchangeAction(BUCKET_X_KIN, BUCKET_X_KIN, multiple * bucketSize),
552559
// ]
553560
message ReceivePaymentsPrivatelyMetadata {
554-
// The temporary incoming or primary account to receive funds from
561+
// The temporary incoming, primary or relationship account to receive funds from
555562
common.v1.SolanaAccountId source = 1 [(validate.rules).message.required = true];
556563

557564
// The exact amount of Kin in quarks being received
558565
uint64 quarks = 2 [(validate.rules).uint64.gt = 0];
559566

560-
// Is the receipt of funds from a deposti? If true, the source account must
561-
// be the primary account. Otherwise, it must be from a temporary incoming
562-
// account.
567+
// Is the receipt of funds from a deposit? If true, the source account must
568+
// be a primary or relationship account. Otherwise, it must be from a temporary
569+
// incoming account.
563570
bool is_deposit = 3;
564571
}
565572

0 commit comments

Comments
 (0)