Skip to content

Commit c532c84

Browse files
committed
chore: update opencode protos; update implementations and prune dead code
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 77f165c commit c532c84

23 files changed

Lines changed: 86 additions & 711 deletions

File tree

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class RealSessionController @Inject constructor(
210210
scope.launch {
211211
userManager.accountCluster?.let {
212212
transactionController.airdrop(
213-
type = AirdropType.GetFirstCrypto,
213+
type = AirdropType.WelcomeBonus,
214214
destination = it.authority.keyPair
215215
).onSuccess { amount ->
216216
toastController.show(

definitions/opencode/protos/src/main/proto/account/v1/account_service.proto

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ service Account {
2020
// GetTokenAccountInfos returns token account metadata relevant to the Code owner
2121
// account.
2222
rpc GetTokenAccountInfos(GetTokenAccountInfosRequest) returns (GetTokenAccountInfosResponse);
23-
24-
// LinkAdditionalAccounts allows a client to declare additional accounts to
25-
// be tracked and used within Code. The accounts declared in this RPC are not
26-
// managed by Code (ie. not a Timelock account), created externally and cannot
27-
// be linked automatically (ie. authority derived off user 12 words).
28-
rpc LinkAdditionalAccounts(LinkAdditionalAccountsRequest) returns (LinkAdditionalAccountsResponse);
2923
}
3024

3125
message IsCodeAccountRequest {
@@ -75,38 +69,6 @@ message GetTokenAccountInfosResponse {
7569
map<string, TokenAccountInfo> token_account_infos = 2;
7670
}
7771

78-
message LinkAdditionalAccountsRequest {
79-
// The owner account to link to
80-
common.v1.SolanaAccountId owner = 1;
81-
82-
83-
// The authority account derived off the user's 12 words, which contains
84-
// the USDC ATA (and potentially others in the future) that will be used
85-
// in swaps.
86-
common.v1.SolanaAccountId swap_authority = 2;
87-
88-
89-
// Signature values for each account provided in this request. Each signature
90-
// must be generated without this array set. The expected ordering of signatures:
91-
// 1. owner
92-
// 2. swap_authority
93-
repeated common.v1.Signature signatures = 3 ;
94-
95-
}
96-
97-
message LinkAdditionalAccountsResponse {
98-
Result result = 1;
99-
enum Result {
100-
// Supports idempotency, and will be returned as long as the request exactly
101-
// matches a previous execution.
102-
OK = 0;
103-
// The action has been denied (eg. owner account not phone verified)
104-
DENIED = 1;
105-
// An account being linked is not valid
106-
INVALID_ACCOUNT = 2;
107-
}
108-
}
109-
11072
message TokenAccountInfo {
11173
// The token account's address
11274
common.v1.SolanaAccountId address = 1;

definitions/opencode/protos/src/main/proto/common/v1/model.proto

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "google/protobuf/timestamp.proto";
99
// AccountType associates a type to an account, which infers how an account is used
1010
// within the Code ecosystem.
1111
//
12-
// todo: Deprecate legacy accounts (temporary, buckets, legacy primary, relationship)
12+
// todo: Deprecate legacy accounts (temporary, buckets, legacy primary, relationship, swap)
1313
enum AccountType {
1414
UNKNOWN = 0;
1515
PRIMARY = 1;
@@ -26,6 +26,7 @@ enum AccountType {
2626
REMOTE_SEND_GIFT_CARD = 12;
2727
RELATIONSHIP = 13;
2828
SWAP = 14;
29+
ASSOCIATED_TOKEN_ACCOUNT = 15;
2930
}
3031
// SolanaAccountId is a raw binary Ed25519 public key for a Solana account
3132
message SolanaAccountId {
@@ -56,10 +57,6 @@ message Signature {
5657
message IntentId {
5758
bytes value = 1 ;
5859
}
59-
// Domain is a hostname
60-
message Domain {
61-
string value = 1 ;
62-
}
6360
// Hash is a raw binary 32 byte hash value
6461
message Hash {
6562
bytes value = 1 ;

definitions/opencode/protos/src/main/proto/messaging/v1/messaging_service.proto

Lines changed: 5 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ option go_package = "github.com/code-payments/code-protobuf-api/generated/go/mes
44
option java_package = "com.codeinc.opencode.gen.messaging.v1";
55
option objc_class_prefix = "CPBMessagingV1";
66
import "common/v1/model.proto";
7-
import "transaction/v2/transaction_service.proto";
87

9-
import "google/protobuf/timestamp.proto";
108
service Messaging {
119
// OpenMessageStream opens a stream of messages. Messages are routed using the
1210
// public key of a rendezvous keypair derived by both the sender and the
@@ -24,24 +22,6 @@ service Messaging {
2422
// 3. The payment recipient scans the code and uses SendMessage to send their account ID
2523
// back to the sender via the rendezvous public key.
2624
// 4. The payment sender receives the message, submits the intent, and closes the stream.
27-
//
28-
// For receiving a bill of requested value, the expected flow is as follows:
29-
// 1. The payment recipient uses SendMessage to send their account ID and payment amount to
30-
// the sender via the rendezvous public key, which is derived by using sha256(scan payload)
31-
// as the keypair seed.
32-
// 2. The payment recipient calls OpenMessageStream on the rendezvous public key to listen
33-
// for status messages generated by client/server. It must ignore the original message it sent
34-
// as part of step 1.
35-
// 3. The payment recipient creates a payment request scan code
36-
// 4. The payment sender calls PollMessages on the rendezvous public key. This is ok because
37-
// we know the message exists per step 1, and doesn't actually incur a long poll. This is a
38-
// required hack because we don't have the infrastructure in place to allow multiple listens
39-
// on the same stream, and the recipient needs real-time status updates.
40-
// 5. The payment sender receives the message (any status messages are ignored), and submits the
41-
// intent.
42-
// 6. The payment recipient observes status message (eg. IntentSubmitted, ClientRejectedPayment,
43-
// WebhookCalled) for payment state.
44-
// 7. The payment recipient closes the stream once the payment hits a terminal state, or times out.
4525
rpc OpenMessageStream(OpenMessageStreamRequest) returns (stream OpenMessageStreamResponse);
4626
// OpenMessageStreamWithKeepAlive is like OpenMessageStream, but enables a ping/pong
4727
// keepalive to determine the health of the stream at both the client and server.
@@ -158,82 +138,6 @@ message RequestToGrabBill {
158138
// payment should be sent.
159139
common.v1.SolanaAccountId requestor_account = 1;
160140
}
161-
// Request that a bill of a requested value is created and sent to the requested
162-
// address.
163-
//
164-
// This message type is only initiated by clients.
165-
message RequestToReceiveBill {
166-
// Requestor is the virtual core mint token account on the VM to which a
167-
// payment should be sent.
168-
common.v1.SolanaAccountId requestor_account = 1;
169-
// The exchange data for the requested bill value.
170-
oneof exchange_data {
171-
// An exact amount of core mint tokens. Payment is guaranteed to transfer the specified
172-
// quarks in the requested currency and exchange rate.
173-
//
174-
// Only supports the core mint account. Use exchange_data.partial for fiat amounts.
175-
transaction.v2.ExchangeData exact = 2;
176-
// Fiat amount request. The amount of core mint tokens are determined at
177-
// time of payment with a recent exchange rate provided by the paying client
178-
// and validated by server.
179-
//
180-
// Only supports fiat amounts. Use exchange_data.exact for the core mint account.
181-
transaction.v2.ExchangeDataWithoutRate partial = 3;
182-
}
183-
//
184-
// Optional fields below to identify a domain requesting to receive a bill.
185-
// Verification of the domain is optional. When verified, clients can establish
186-
// relationships and third parties will by able to identify users with that
187-
// account after payment is made.
188-
//
189-
// Note on field requirements:
190-
// - Verified: All of domain, verifier, signature and rendezvous_key are required
191-
// - Unverified: Only domain is requried
192-
//
193-
// The third-party's domain name, which is its primary identifier. Server
194-
// guarantees to perform domain verification against the verifier account.
195-
common.v1.Domain domain = 4;
196-
// Owner account owned by the third party used in domain verification.
197-
common.v1.SolanaAccountId verifier = 5;
198-
// Signature of this message using the verifier private key, which in addition
199-
// to domain verification, authenticates the third party.
200-
common.v1.Signature signature = 6;
201-
// Rendezvous key to avoid replay attacks
202-
RendezvousKey rendezvous_key = 7;
203-
// Additional fee payments splitting the requested amount. This is in addition
204-
// to the hard-coded Code $0.01 USD fee.
205-
repeated transaction.v2.AdditionalFeePayment additional_fees = 8;
206-
}
207-
// A status update on a stream to indicate a scan code was scanned. This can appear
208-
// multiple times for the same stream.
209-
//
210-
// This message type is only initiated by client
211-
message CodeScanned {
212-
// Timestamp the client scanned the code
213-
google.protobuf.Timestamp timestamp = 1;
214-
}
215-
// Payment is rejected by the client
216-
//
217-
// This message type is only initiated by clients
218-
message ClientRejectedPayment {
219-
common.v1.IntentId intent_id = 1;
220-
}
221-
// Intent was submitted via SubmitIntent
222-
//
223-
// This message type is only initiated by server
224-
message IntentSubmitted {
225-
common.v1.IntentId intent_id = 1;
226-
// Metadata is available for intents where it can be safely propagated publicly.
227-
// Anything else requires an additional authenticated RPC call (eg. login).
228-
transaction.v2.Metadata metadata = 2;
229-
}
230-
// Webhook was successfully called
231-
//
232-
// This message type is only initiated by server
233-
message WebhookCalled {
234-
// Estimated time webhook was received
235-
google.protobuf.Timestamp timestamp = 1;
236-
}
237141
message Message {
238142
// MessageId is the Id of the message. This ID is generated by the
239143
// server, and will _always_ be set when receiving a message.
@@ -252,16 +156,13 @@ message Message {
252156
// Section: Cash
253157
//
254158
RequestToGrabBill request_to_grab_bill = 2;
255-
//
256-
// Section: Payment Requests
257-
//
258-
RequestToReceiveBill request_to_receive_bill = 5;
259-
CodeScanned code_scanned = 6;
260-
ClientRejectedPayment client_rejected_payment = 7;
261-
IntentSubmitted intent_submitted = 8;
262-
WebhookCalled webhook_called = 9;
263159
}
264160
reserved 4; // Deprecated AirdropReceived field
161+
reserved 5; // Deprecated RequestToReceiveBill field
162+
reserved 6; // Deprecated CodeScanned field
163+
reserved 7; // Deprecated ClientRejectedPayment field
164+
reserved 8; // Deprecated IntentSubmitted field
165+
reserved 9; // Deprecated WebhookCalled field
265166
reserved 10; // Deprecated RequestToLogin field
266167
reserved 11; // Deprecated LoginAttempt field
267168
reserved 12; // Deprecated ClientRejectedLogin field

definitions/opencode/protos/src/main/proto/micropayment/v1/micro_payment_service.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ option go_package = "github.com/code-payments/code-protobuf-api/generated/go/mic
44
option java_package = "com.codeinc.opencode.gen.micropayment.v1";
55
option objc_class_prefix = "APBMicroPaymentV1";
66
import "common/v1/model.proto";
7-
87
// todo: Migrate this to a generic "request" service
98
service MicroPayment {
109
// GetStatus gets basic request status

0 commit comments

Comments
 (0)