Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit eb83604

Browse files
committed
fix: adapt to binary64 -> base64 rename
1 parent d527e39 commit eb83604

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

web3.js/src/connection.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ const GetTokenAccountsByOwner = jsonRpcResultAndContext(
713713
executable: 'boolean',
714714
owner: 'string',
715715
lamports: 'number',
716-
data: ['string', struct.literal('binary64')],
716+
data: ['string', struct.literal('base64')],
717717
rentEpoch: 'number?',
718718
}),
719719
}),
@@ -795,7 +795,7 @@ const ParsedAccountInfoResult = struct.object({
795795
owner: 'string',
796796
lamports: 'number',
797797
data: struct.union([
798-
['string', struct.literal('binary64')],
798+
['string', struct.literal('base64')],
799799
struct.pick({
800800
program: 'string',
801801
parsed: 'any',
@@ -1613,7 +1613,7 @@ export class Connection {
16131613
_args.push({programId: filter.programId.toBase58()});
16141614
}
16151615

1616-
const args = this._buildArgs(_args, commitment, 'binary64');
1616+
const args = this._buildArgs(_args, commitment, 'base64');
16171617
const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);
16181618
const res = GetTokenAccountsByOwner(unsafeRes);
16191619
if (res.error) {
@@ -1632,7 +1632,7 @@ export class Connection {
16321632
return {
16331633
context,
16341634
value: value.map(result => {
1635-
assert(result.account.data[1] === 'binary64');
1635+
assert(result.account.data[1] === 'base64');
16361636
return {
16371637
pubkey: new PublicKey(result.pubkey),
16381638
account: {
@@ -1755,7 +1755,7 @@ export class Connection {
17551755
const args = this._buildArgs(
17561756
[publicKey.toBase58()],
17571757
commitment,
1758-
'binary64',
1758+
'base64',
17591759
);
17601760
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
17611761
const res = GetAccountInfoAndContextRpcResult(unsafeRes);
@@ -1772,7 +1772,7 @@ export class Connection {
17721772
let value = null;
17731773
if (res.result.value) {
17741774
const {executable, owner, lamports, data} = res.result.value;
1775-
assert(data[1] === 'binary64');
1775+
assert(data[1] === 'base64');
17761776
value = {
17771777
executable,
17781778
owner: new PublicKey(owner),
@@ -1821,7 +1821,7 @@ export class Connection {
18211821

18221822
let data = resultData;
18231823
if (!data.program) {
1824-
assert(data[1] === 'binary64');
1824+
assert(data[1] === 'base64');
18251825
data = Buffer.from(data[0], 'base64');
18261826
}
18271827

@@ -1869,7 +1869,7 @@ export class Connection {
18691869
const args = this._buildArgs(
18701870
[programId.toBase58()],
18711871
commitment,
1872-
'binary64',
1872+
'base64',
18731873
);
18741874
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
18751875
const res = GetProgramAccountsRpcResult(unsafeRes);
@@ -1886,7 +1886,7 @@ export class Connection {
18861886
assert(typeof result !== 'undefined');
18871887

18881888
return result.map(result => {
1889-
assert(result.account.data[1] === 'binary64');
1889+
assert(result.account.data[1] === 'base64');
18901890
return {
18911891
pubkey: new PublicKey(result.pubkey),
18921892
account: {
@@ -1937,7 +1937,7 @@ export class Connection {
19371937

19381938
let data = resultData;
19391939
if (!data.program) {
1940-
assert(data[1] === 'binary64');
1940+
assert(data[1] === 'base64');
19411941
data = Buffer.from(data[0], 'base64');
19421942
}
19431943

@@ -2783,7 +2783,7 @@ export class Connection {
27832783
this._subscribe(
27842784
sub,
27852785
'accountSubscribe',
2786-
this._buildArgs([sub.publicKey], sub.commitment, 'binary64'),
2786+
this._buildArgs([sub.publicKey], sub.commitment, 'base64'),
27872787
);
27882788
}
27892789

@@ -2792,7 +2792,7 @@ export class Connection {
27922792
this._subscribe(
27932793
sub,
27942794
'programSubscribe',
2795-
this._buildArgs([sub.programId], sub.commitment, 'binary64'),
2795+
this._buildArgs([sub.programId], sub.commitment, 'base64'),
27962796
);
27972797
}
27982798

@@ -2906,7 +2906,7 @@ export class Connection {
29062906
const {result} = res;
29072907
const {value, context} = result;
29082908

2909-
assert(value.account.data[1] === 'binary64');
2909+
assert(value.account.data[1] === 'base64');
29102910
sub.callback(
29112911
{
29122912
accountId: value.pubkey,
@@ -3024,7 +3024,7 @@ export class Connection {
30243024
_buildArgs(
30253025
args: Array<any>,
30263026
override: ?Commitment,
3027-
encoding?: 'jsonParsed' | 'binary64',
3027+
encoding?: 'jsonParsed' | 'base64',
30283028
): Array<any> {
30293029
const commitment = override || this._commitment;
30303030
if (commitment || encoding) {

web3.js/test/connection.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test('get account info - not found', async () => {
6363
url,
6464
{
6565
method: 'getAccountInfo',
66-
params: [account.publicKey.toBase58(), {encoding: 'binary64'}],
66+
params: [account.publicKey.toBase58(), {encoding: 'base64'}],
6767
},
6868
{
6969
error: null,
@@ -255,15 +255,15 @@ test('get program accounts', async () => {
255255
method: 'getProgramAccounts',
256256
params: [
257257
programId.publicKey.toBase58(),
258-
{commitment: 'recent', encoding: 'binary64'},
258+
{commitment: 'recent', encoding: 'base64'},
259259
],
260260
},
261261
{
262262
error: null,
263263
result: [
264264
{
265265
account: {
266-
data: ['', 'binary64'],
266+
data: ['', 'base64'],
267267
executable: false,
268268
lamports: LAMPORTS_PER_SOL - feeCalculator.lamportsPerSignature,
269269
owner: programId.publicKey.toBase58(),
@@ -273,7 +273,7 @@ test('get program accounts', async () => {
273273
},
274274
{
275275
account: {
276-
data: ['', 'binary64'],
276+
data: ['', 'base64'],
277277
executable: false,
278278
lamports:
279279
0.5 * LAMPORTS_PER_SOL - feeCalculator.lamportsPerSignature,
@@ -1681,7 +1681,7 @@ test('request airdrop', async () => {
16811681
method: 'getAccountInfo',
16821682
params: [
16831683
account.publicKey.toBase58(),
1684-
{commitment: 'recent', encoding: 'binary64'},
1684+
{commitment: 'recent', encoding: 'base64'},
16851685
],
16861686
},
16871687
{
@@ -1693,7 +1693,7 @@ test('request airdrop', async () => {
16931693
value: {
16941694
owner: '11111111111111111111111111111111',
16951695
lamports: minimumAmount + 42,
1696-
data: ['', 'binary64'],
1696+
data: ['', 'base64'],
16971697
executable: false,
16981698
},
16991699
},
@@ -1727,7 +1727,7 @@ test('request airdrop', async () => {
17271727
value: {
17281728
owner: '11111111111111111111111111111111',
17291729
lamports: minimumAmount + 42,
1730-
data: ['', 'binary64'],
1730+
data: ['', 'base64'],
17311731
executable: false,
17321732
},
17331733
},

web3.js/test/nonce.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const expectedData = (authorizedPubkey: PublicKey): [string, string] => {
2222
const mockNonce = new Account();
2323
mockNonce.publicKey.toBuffer().copy(expectedData, 40); // Hash, 32 bytes
2424
expectedData.writeUInt16LE(5000, 72); // feeCalculator, 8 bytes
25-
return [expectedData.toString('base64'), 'binary64'];
25+
return [expectedData.toString('base64'), 'base64'];
2626
};
2727

2828
test('create and query nonce account', async () => {
@@ -121,7 +121,7 @@ test('create and query nonce account', async () => {
121121
method: 'getAccountInfo',
122122
params: [
123123
nonceAccount.publicKey.toBase58(),
124-
{encoding: 'binary64', commitment: 'recent'},
124+
{encoding: 'base64', commitment: 'recent'},
125125
],
126126
},
127127
{
@@ -248,7 +248,7 @@ test('create and query nonce account with seed', async () => {
248248
method: 'getAccountInfo',
249249
params: [
250250
noncePubkey.toBase58(),
251-
{encoding: 'binary64', commitment: 'recent'},
251+
{encoding: 'base64', commitment: 'recent'},
252252
],
253253
},
254254
{

0 commit comments

Comments
 (0)