Skip to content

Commit 49d3070

Browse files
author
Jeff Yanta
committed
Clean up transaction service and add proposed new remote send flow
1 parent fb01c98 commit 49d3070

File tree

6 files changed

+460
-419
lines changed

6 files changed

+460
-419
lines changed

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

Lines changed: 385 additions & 367 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: 2 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_grpc.pb.go

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const Transaction = {
9292
kind: MethodKind.Unary,
9393
},
9494
/**
95-
* Airdrop airdrops Kin to the requesting account
95+
* Airdrop airdrops core mint tokens to the requesting account
9696
*
9797
* @generated from rpc code.transaction.v2.Transaction.Airdrop
9898
*/
@@ -121,8 +121,8 @@ export const Transaction = {
121121
* 4. Dynamic swap instruction
122122
* 5. SwapValidator::PostSwap
123123
*
124-
* Note: Currently limited to swapping USDC to Kin.
125-
* Note: Kin is deposited into the token account derived from the VM deposit PDA of the owner account.
124+
* Note: Currently limited to swapping USDC to core mint tokens.
125+
* Note: Core mint tokens are deposited into the token account derived from the VM deposit PDA of the owner account.
126126
*
127127
* @generated from rpc code.transaction.v2.Transaction.Swap
128128
*/
@@ -134,7 +134,7 @@ export const Transaction = {
134134
},
135135
/**
136136
* DeclareFiatOnrampPurchaseAttempt is called whenever a user attempts to use a fiat
137-
* onramp to purchase crypto for use in Code.
137+
* onramp to purchase core mint tokens for use in Code.
138138
*
139139
* @generated from rpc code.transaction.v2.Transaction.DeclareFiatOnrampPurchaseAttempt
140140
*/

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

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ export class AirdropRequest extends Message<AirdropRequest> {
840840
airdropType = AirdropType.UNKNOWN;
841841

842842
/**
843-
* The owner account to airdrop Kin to
843+
* The owner account to airdrop core mint tokens to
844844
*
845845
* @generated from field: code.common.v1.SolanaAccountId owner = 2;
846846
*/
@@ -895,7 +895,7 @@ export class AirdropResponse extends Message<AirdropResponse> {
895895
result = AirdropResponse_Result.OK;
896896

897897
/**
898-
* Exchange data for the amount of Kin airdropped when successful
898+
* Exchange data for the amount of core mint tokens airdropped when successful
899899
*
900900
* @generated from field: code.transaction.v2.ExchangeData exchange_data = 2;
901901
*/
@@ -1648,7 +1648,7 @@ export class Metadata extends Message<Metadata> {
16481648

16491649
/**
16501650
* Open a set of accounts. Currently, clients should only use this for new users
1651-
* to open all required accounts up front (buckets, incoming, and outgoing).
1651+
* to open all required accounts up front..
16521652
*
16531653
* Action Spec:
16541654
*
@@ -1690,10 +1690,20 @@ export class OpenAccountsMetadata extends Message<OpenAccountsMetadata> {
16901690
/**
16911691
* Send a payment to a destination account publicly.
16921692
*
1693-
* Action Spec:
1693+
* Action Spec (Payment, Withdrawal):
16941694
*
16951695
* actions = [NoPrivacyTransferAction(PRIMARY, destination, ExchangeData.Quarks)]
16961696
*
1697+
* Action Spec (Remote Send):
1698+
*
1699+
* actions = [
1700+
* OpenAccountAction(REMOTE_SEND_GIFT_CARD),
1701+
* NoPrivacyTransferAction(PRIMARY, REMOTE_SEND_GIFT_CARD, ExchangeData.Quarks),
1702+
* NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, PRIMARY, ExchangeData.Quarks),
1703+
* ]
1704+
*
1705+
* todo: Possibly use a different action type for deferred closing?
1706+
*
16971707
* @generated from message code.transaction.v2.SendPublicPaymentMetadata
16981708
*/
16991709
export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata> {
@@ -1706,8 +1716,7 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17061716
source?: SolanaAccountId;
17071717

17081718
/**
1709-
* The destination token account to send funds to. This cannot be a Code
1710-
* temporary account.
1719+
* The destination token account to send funds to.
17111720
*
17121721
* @generated from field: code.common.v1.SolanaAccountId destination = 1;
17131722
*/
@@ -1727,6 +1736,13 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17271736
*/
17281737
isWithdrawal = false;
17291738

1739+
/**
1740+
* Is the payment going to a new gift card? Note is_withdrawal must be false.
1741+
*
1742+
* @generated from field: bool is_remote_send = 5;
1743+
*/
1744+
isRemoteSend = false;
1745+
17301746
constructor(data?: PartialMessage<SendPublicPaymentMetadata>) {
17311747
super();
17321748
proto3.util.initPartial(data, this);
@@ -1739,6 +1755,7 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17391755
{ no: 1, name: "destination", kind: "message", T: SolanaAccountId },
17401756
{ no: 2, name: "exchange_data", kind: "message", T: ExchangeData },
17411757
{ no: 3, name: "is_withdrawal", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
1758+
{ no: 5, name: "is_remote_send", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
17421759
]);
17431760

17441761
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SendPublicPaymentMetadata {
@@ -1760,15 +1777,11 @@ export class SendPublicPaymentMetadata extends Message<SendPublicPaymentMetadata
17601777

17611778
/**
17621779
* Receive funds into a user-owned account publicly. All use cases of this intent
1763-
* close the account, so all funds must be moved. Use this intent to receive payments
1764-
* from an account not owned by a user's 12 words into a temporary incoming account,
1765-
* which will guarantee privacy upgradeability.
1780+
* close the account, so all funds must be moved.
17661781
*
17671782
* Action Spec (Remote Send):
17681783
*
1769-
* actions = [NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, TEMPORARY_INCOMING[latest_index], quarks)]
1770-
*
1771-
* TODO: This requires a new implementation for the VM
1784+
* actions = [NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, PRIMARY, quarks)]
17721785
*
17731786
* @generated from message code.transaction.v2.ReceivePaymentsPubliclyMetadata
17741787
*/
@@ -1781,7 +1794,7 @@ export class ReceivePaymentsPubliclyMetadata extends Message<ReceivePaymentsPubl
17811794
source?: SolanaAccountId;
17821795

17831796
/**
1784-
* The exact amount of Kin in quarks being received
1797+
* The exact amount of core mint quarks being received
17851798
*
17861799
* @generated from field: uint64 quarks = 2;
17871800
*/
@@ -2038,7 +2051,7 @@ export class NoPrivacyTransferAction extends Message<NoPrivacyTransferAction> {
20382051
destination?: SolanaAccountId;
20392052

20402053
/**
2041-
* The Kin quark amount to transfer
2054+
* The core mint quark amount to transfer
20422055
*
20432056
* @generated from field: uint64 amount = 4;
20442057
*/
@@ -2103,7 +2116,7 @@ export class NoPrivacyWithdrawAction extends Message<NoPrivacyWithdrawAction> {
21032116
destination?: SolanaAccountId;
21042117

21052118
/**
2106-
* The intended Kin quark amount to withdraw
2119+
* The intended core mint quark amount to withdraw
21072120
*
21082121
* @generated from field: uint64 amount = 4;
21092122
*/
@@ -2177,7 +2190,7 @@ export class FeePaymentAction extends Message<FeePaymentAction> {
21772190
source?: SolanaAccountId;
21782191

21792192
/**
2180-
* The Kin quark amount to transfer
2193+
* The core mint quark amount to transfer
21812194
*
21822195
* @generated from field: uint64 amount = 3;
21832196
*/
@@ -2752,7 +2765,7 @@ proto3.util.setEnumType(DeniedErrorDetails_Code, "code.transaction.v2.DeniedErro
27522765
]);
27532766

27542767
/**
2755-
* ExchangeData defines an amount of Kin with currency exchange data
2768+
* ExchangeData defines an amount of crypto with currency exchange data
27562769
*
27572770
* @generated from message code.transaction.v2.ExchangeData
27582771
*/
@@ -2872,7 +2885,7 @@ export class ExchangeDataWithoutRate extends Message<ExchangeDataWithoutRate> {
28722885
*/
28732886
export class AdditionalFeePayment extends Message<AdditionalFeePayment> {
28742887
/**
2875-
* Destination Kin token account where the fee payment will be made
2888+
* Destination token account where the fee payment will be made
28762889
*
28772890
* @generated from field: code.common.v1.SolanaAccountId destination = 1;
28782891
*/

proto/transaction/v2/transaction_service.proto

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ service Transaction {
5858
// The RPC indicates if a withdrawal is possible, and how it should be performed.
5959
rpc CanWithdrawToAccount(CanWithdrawToAccountRequest) returns (CanWithdrawToAccountResponse);
6060

61-
// Airdrop airdrops Kin to the requesting account
61+
// Airdrop airdrops core mint tokens to the requesting account
6262
rpc Airdrop(AirdropRequest) returns (AirdropResponse);
6363

6464
// Swap performs an on-chain swap. The high-level flow mirrors SubmitIntent
@@ -79,12 +79,12 @@ service Transaction {
7979
// 4. Dynamic swap instruction
8080
// 5. SwapValidator::PostSwap
8181
//
82-
// Note: Currently limited to swapping USDC to Kin.
83-
// Note: Kin is deposited into the token account derived from the VM deposit PDA of the owner account.
82+
// Note: Currently limited to swapping USDC to core mint tokens.
83+
// Note: Core mint tokens are deposited into the token account derived from the VM deposit PDA of the owner account.
8484
rpc Swap(stream SwapRequest) returns (stream SwapResponse);
8585

8686
// DeclareFiatOnrampPurchaseAttempt is called whenever a user attempts to use a fiat
87-
// onramp to purchase crypto for use in Code.
87+
// onramp to purchase core mint tokens for use in Code.
8888
rpc DeclareFiatOnrampPurchaseAttempt(DeclareFiatOnrampPurchaseAttemptRequest) returns (DeclareFiatOnrampPurchaseAttemptResponse);
8989
}
9090

@@ -280,7 +280,7 @@ message AirdropRequest {
280280
not_in: [0, 1] // UNKNOWN, GIVE_FIRST_CRYPTO
281281
}];
282282

283-
// The owner account to airdrop Kin to
283+
// The owner account to airdrop core mint tokens to
284284
common.v1.SolanaAccountId owner = 2 [(validate.rules).message.required = true];
285285

286286
// The signature is of serialize(AirdropRequest) without this field set
@@ -299,7 +299,7 @@ message AirdropResponse {
299299
ALREADY_CLAIMED = 2;
300300
}
301301

302-
// Exchange data for the amount of Kin airdropped when successful
302+
// Exchange data for the amount of core mint tokens airdropped when successful
303303
ExchangeData exchange_data = 2;
304304
}
305305

@@ -474,7 +474,7 @@ message Metadata {
474474
}
475475

476476
// Open a set of accounts. Currently, clients should only use this for new users
477-
// to open all required accounts up front (buckets, incoming, and outgoing).
477+
// to open all required accounts up front..
478478
//
479479
// Action Spec:
480480
//
@@ -486,40 +486,48 @@ message OpenAccountsMetadata {
486486

487487
// Send a payment to a destination account publicly.
488488
//
489-
// Action Spec:
489+
// Action Spec (Payment, Withdrawal):
490490
//
491491
// actions = [NoPrivacyTransferAction(PRIMARY, destination, ExchangeData.Quarks)]
492+
//
493+
// Action Spec (Remote Send):
494+
//
495+
// actions = [
496+
// OpenAccountAction(REMOTE_SEND_GIFT_CARD),
497+
// NoPrivacyTransferAction(PRIMARY, REMOTE_SEND_GIFT_CARD, ExchangeData.Quarks),
498+
// NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, PRIMARY, ExchangeData.Quarks),
499+
// ]
500+
//
501+
// todo: Possibly use a different action type for deferred closing?
492502
message SendPublicPaymentMetadata {
493503
// The primary account where funds will be sent from. The primary account is assumed if this
494504
// field is not set for backwards compatibility with old clients.
495505
common.v1.SolanaAccountId source = 4;
496506

497-
// The destination token account to send funds to. This cannot be a Code
498-
// temporary account.
507+
// The destination token account to send funds to.
499508
common.v1.SolanaAccountId destination = 1 [(validate.rules).message.required = true];
500509

501510
// The exchange data of total funds being sent to the destination
502511
ExchangeData exchange_data = 2 [(validate.rules).message.required = true];
503512

504513
// Is the payment a withdrawal?
505514
bool is_withdrawal = 3;
515+
516+
// Is the payment going to a new gift card? Note is_withdrawal must be false.
517+
bool is_remote_send = 5;
506518
}
507519

508520
// Receive funds into a user-owned account publicly. All use cases of this intent
509-
// close the account, so all funds must be moved. Use this intent to receive payments
510-
// from an account not owned by a user's 12 words into a temporary incoming account,
511-
// which will guarantee privacy upgradeability.
521+
// close the account, so all funds must be moved.
512522
//
513523
// Action Spec (Remote Send):
514524
//
515-
// actions = [NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, TEMPORARY_INCOMING[latest_index], quarks)]
516-
//
517-
// TODO: This requires a new implementation for the VM
525+
// actions = [NoPrivacyWithdrawAction(REMOTE_SEND_GIFT_CARD, PRIMARY, quarks)]
518526
message ReceivePaymentsPubliclyMetadata {
519527
// The remote send gift card to receive funds from
520528
common.v1.SolanaAccountId source = 1 [(validate.rules).message.required = true];
521529

522-
// The exact amount of Kin in quarks being received
530+
// The exact amount of core mint quarks being received
523531
uint64 quarks = 2 [(validate.rules).uint64.gt = 0];
524532

525533
// Is the receipt of funds from a remote send gift card? Currently, this is
@@ -603,7 +611,7 @@ message NoPrivacyTransferAction {
603611
// The destination account where funds are transferred to
604612
common.v1.SolanaAccountId destination = 3 [(validate.rules).message.required = true];
605613

606-
// The Kin quark amount to transfer
614+
// The core mint quark amount to transfer
607615
uint64 amount = 4 [(validate.rules).uint64.gt = 0];
608616
}
609617

@@ -618,7 +626,7 @@ message NoPrivacyWithdrawAction {
618626
// The destination account where funds are transferred to
619627
common.v1.SolanaAccountId destination = 3 [(validate.rules).message.required = true];
620628

621-
// The intended Kin quark amount to withdraw
629+
// The intended core mint quark amount to withdraw
622630
uint64 amount = 4 [(validate.rules).uint64.gt = 0];
623631

624632
// Whether the account is closed afterwards. This is always true, since there
@@ -641,7 +649,7 @@ message FeePaymentAction {
641649
// The source account where funds are transferred from
642650
common.v1.SolanaAccountId source = 2 [(validate.rules).message.required = true];
643651

644-
// The Kin quark amount to transfer
652+
// The core mint quark amount to transfer
645653
uint64 amount = 3 [(validate.rules).uint64.gt = 0];
646654

647655
// The destination where the fee payment is being made for fees outside of
@@ -771,7 +779,7 @@ message DeniedErrorDetails {
771779
//
772780

773781

774-
// ExchangeData defines an amount of Kin with currency exchange data
782+
// ExchangeData defines an amount of crypto with currency exchange data
775783
message ExchangeData {
776784
// ISO 4217 alpha-3 currency code.
777785
string currency = 1 [(validate.rules).string = { pattern: "^[a-z]{3,4}$" }];
@@ -799,7 +807,7 @@ message ExchangeDataWithoutRate {
799807
}
800808

801809
message AdditionalFeePayment {
802-
// Destination Kin token account where the fee payment will be made
810+
// Destination token account where the fee payment will be made
803811
common.v1.SolanaAccountId destination = 1 [(validate.rules).message.required = true];
804812

805813
// Fee percentage, in basis points, of the total quark amount of a payment.

0 commit comments

Comments
 (0)