Skip to content

Commit 971825b

Browse files
authored
Merge pull request #2 from code-payments/ata-info
Add support for associated token accounts in TokenAccountInfo
2 parents 922add4 + ff49468 commit 971825b

File tree

7 files changed

+232
-131
lines changed

7 files changed

+232
-131
lines changed

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

Lines changed: 110 additions & 73 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: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/go/common/v1/model.pb.go

Lines changed: 43 additions & 38 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: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ export class TokenAccountInfo extends Message<TokenAccountInfo> {
291291
balanceSource = TokenAccountInfo_BalanceSource.UNKNOWN;
292292

293293
/**
294-
* The Kin balance in quarks, as observed by Code. This may not reflect the
295-
* value on the blockchain and could be non-zero even if the account hasn't
296-
* been created. Use balance_source to determine how this value was calculated.
294+
* The balance in quarks, as observed by Code. This may not reflect the value
295+
* on the blockchain and could be non-zero even if the account hasn't been created.
296+
* Use balance_source to determine how this value was calculated.
297297
*
298298
* @generated from field: uint64 balance = 7;
299299
*/
@@ -345,6 +345,27 @@ export class TokenAccountInfo extends Message<TokenAccountInfo> {
345345
*/
346346
originalExchangeData?: ExchangeData;
347347

348+
/**
349+
* The token account's mint
350+
*
351+
* @generated from field: code.common.v1.SolanaAccountId mint = 13;
352+
*/
353+
mint?: SolanaAccountId;
354+
355+
/**
356+
* The number of decimals configured for the mint
357+
*
358+
* @generated from field: uint32 mint_decimals = 14;
359+
*/
360+
mintDecimals = 0;
361+
362+
/**
363+
* User-friendly display name for the mint
364+
*
365+
* @generated from field: string mint_display_name = 15;
366+
*/
367+
mintDisplayName = "";
368+
348369
constructor(data?: PartialMessage<TokenAccountInfo>) {
349370
super();
350371
proto3.util.initPartial(data, this);
@@ -365,6 +386,9 @@ export class TokenAccountInfo extends Message<TokenAccountInfo> {
365386
{ no: 10, name: "must_rotate", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
366387
{ no: 11, name: "claim_state", kind: "enum", T: proto3.getEnumType(TokenAccountInfo_ClaimState) },
367388
{ no: 12, name: "original_exchange_data", kind: "message", T: ExchangeData },
389+
{ no: 13, name: "mint", kind: "message", T: SolanaAccountId },
390+
{ no: 14, name: "mint_decimals", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
391+
{ no: 15, name: "mint_display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
368392
]);
369393

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

generated/protobuf-es/common/v1/model_pb.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ export enum AccountType {
8282
* @generated from enum value: RELATIONSHIP = 13;
8383
*/
8484
RELATIONSHIP = 13,
85+
86+
/**
87+
* @generated from enum value: ASSOCIATED_TOKEN_ACCOUNT = 14;
88+
*/
89+
ASSOCIATED_TOKEN_ACCOUNT = 14,
8590
}
8691
// Retrieve enum metadata with: proto3.getEnumType(AccountType)
8792
proto3.util.setEnumType(AccountType, "code.common.v1.AccountType", [
@@ -99,6 +104,7 @@ proto3.util.setEnumType(AccountType, "code.common.v1.AccountType", [
99104
{ no: 11, name: "LEGACY_PRIMARY_2022" },
100105
{ no: 12, name: "REMOTE_SEND_GIFT_CARD" },
101106
{ no: 13, name: "RELATIONSHIP" },
107+
{ no: 14, name: "ASSOCIATED_TOKEN_ACCOUNT" },
102108
]);
103109

104110
/**

proto/account/v1/account_service.proto

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ message TokenAccountInfo {
9999
BALANCE_SOURCE_CACHE = 2;
100100
}
101101

102-
// The Kin balance in quarks, as observed by Code. This may not reflect the
103-
// value on the blockchain and could be non-zero even if the account hasn't
104-
// been created. Use balance_source to determine how this value was calculated.
102+
// The balance in quarks, as observed by Code. This may not reflect the value
103+
// on the blockchain and could be non-zero even if the account hasn't been created.
104+
// Use balance_source to determine how this value was calculated.
105105
uint64 balance = 7;
106106

107107
// The state of the account as it pertains to Code's ability to manage funds.
@@ -173,4 +173,13 @@ message TokenAccountInfo {
173173
// 3. The balance could have been received, so the total balance can show
174174
// as zero.
175175
transaction.v2.ExchangeData original_exchange_data = 12;
176+
177+
// The token account's mint
178+
common.v1.SolanaAccountId mint = 13;
179+
180+
// The number of decimals configured for the mint
181+
uint32 mint_decimals = 14;
182+
183+
// User-friendly display name for the mint
184+
string mint_display_name = 15 [(validate.rules).string.max_len = 32];
176185
}

proto/common/v1/model.proto

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ import "validate/validate.proto";
1111
// AccountType associates a type to an account, which infers how an account is used
1212
// within the Code ecosystem.
1313
enum AccountType {
14-
UNKNOWN = 0;
15-
PRIMARY = 1;
16-
TEMPORARY_INCOMING = 2;
17-
TEMPORARY_OUTGOING = 3;
18-
BUCKET_1_KIN = 4;
19-
BUCKET_10_KIN = 5;
20-
BUCKET_100_KIN = 6;
21-
BUCKET_1_000_KIN = 7;
22-
BUCKET_10_000_KIN = 8;
23-
BUCKET_100_000_KIN = 9;
24-
BUCKET_1_000_000_KIN = 10;
25-
LEGACY_PRIMARY_2022 = 11;
26-
REMOTE_SEND_GIFT_CARD = 12;
27-
RELATIONSHIP = 13;
14+
UNKNOWN = 0;
15+
PRIMARY = 1;
16+
TEMPORARY_INCOMING = 2;
17+
TEMPORARY_OUTGOING = 3;
18+
BUCKET_1_KIN = 4;
19+
BUCKET_10_KIN = 5;
20+
BUCKET_100_KIN = 6;
21+
BUCKET_1_000_KIN = 7;
22+
BUCKET_10_000_KIN = 8;
23+
BUCKET_100_000_KIN = 9;
24+
BUCKET_1_000_000_KIN = 10;
25+
LEGACY_PRIMARY_2022 = 11;
26+
REMOTE_SEND_GIFT_CARD = 12;
27+
RELATIONSHIP = 13;
28+
ASSOCIATED_TOKEN_ACCOUNT = 14;
2829
}
2930

3031
// SolanaAccountId is a raw binary Ed25519 public key for a Solana account

0 commit comments

Comments
 (0)