Skip to content

Commit f94307d

Browse files
committed
Update Lamports type from web3.js v2
1 parent e873c14 commit f94307d

File tree

6 files changed

+18
-22
lines changed

6 files changed

+18
-22
lines changed

.changeset/pretty-walls-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/renderers-js': minor
3+
---
4+
5+
Update the `Lamports` type to match its latest definition in version `2.0.0` and onwards.

packages/renderers-js/e2e/system/src/generated/accounts/nonce.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
type Encoder,
3030
type FetchAccountConfig,
3131
type FetchAccountsConfig,
32-
type LamportsUnsafeBeyond2Pow53Minus1,
32+
type Lamports,
3333
type MaybeAccount,
3434
type MaybeEncodedAccount,
3535
} from '@solana/web3.js';
@@ -49,15 +49,15 @@ export type Nonce = {
4949
state: NonceState;
5050
authority: Address;
5151
blockhash: Address;
52-
lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;
52+
lamportsPerSignature: Lamports;
5353
};
5454

5555
export type NonceArgs = {
5656
version: NonceVersionArgs;
5757
state: NonceStateArgs;
5858
authority: Address;
5959
blockhash: Address;
60-
lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;
60+
lamportsPerSignature: Lamports;
6161
};
6262

6363
export function getNonceEncoder(): Encoder<NonceArgs> {

packages/renderers-js/e2e/system/src/generated/instructions/createAccount.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
type IInstruction,
3030
type IInstructionWithAccounts,
3131
type IInstructionWithData,
32-
type LamportsUnsafeBeyond2Pow53Minus1,
32+
type Lamports,
3333
type TransactionSigner,
3434
type WritableSignerAccount,
3535
} from '@solana/web3.js';
@@ -69,13 +69,13 @@ export type CreateAccountInstruction<
6969

7070
export type CreateAccountInstructionData = {
7171
discriminator: number;
72-
lamports: LamportsUnsafeBeyond2Pow53Minus1;
72+
lamports: Lamports;
7373
space: bigint;
7474
programAddress: Address;
7575
};
7676

7777
export type CreateAccountInstructionDataArgs = {
78-
lamports: LamportsUnsafeBeyond2Pow53Minus1;
78+
lamports: Lamports;
7979
space: number | bigint;
8080
programAddress: Address;
8181
};

packages/renderers-js/e2e/token/src/generated/instructions/createAccount.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
type IInstruction,
3030
type IInstructionWithAccounts,
3131
type IInstructionWithData,
32-
type LamportsUnsafeBeyond2Pow53Minus1,
32+
type Lamports,
3333
type TransactionSigner,
3434
type WritableSignerAccount,
3535
} from '@solana/web3.js';
@@ -69,13 +69,13 @@ export type CreateAccountInstruction<
6969

7070
export type CreateAccountInstructionData = {
7171
discriminator: number;
72-
lamports: LamportsUnsafeBeyond2Pow53Minus1;
72+
lamports: Lamports;
7373
space: bigint;
7474
programAddress: Address;
7575
};
7676

7777
export type CreateAccountInstructionDataArgs = {
78-
lamports: LamportsUnsafeBeyond2Pow53Minus1;
78+
lamports: Lamports;
7979
space: number | bigint;
8080
programAddress: Address;
8181
};

packages/renderers-js/src/getTypeManifestVisitor.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,8 @@ export function getTypeManifestVisitor(input: {
719719
visitSolAmountType({ number }, { self }) {
720720
const numberManifest = visit(number, self);
721721

722-
const lamportsType = 'LamportsUnsafeBeyond2Pow53Minus1';
723-
const lamportsImport = new ImportMap().add(
724-
'solanaRpcTypes',
725-
'type LamportsUnsafeBeyond2Pow53Minus1',
726-
);
722+
const lamportsType = 'Lamports';
723+
const lamportsImport = new ImportMap().add('solanaRpcTypes', 'type Lamports');
727724

728725
return {
729726
...numberManifest,

packages/renderers-js/test/types/solAmount.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,14 @@ test('it renders size prefix codecs', async () => {
1717

1818
// Then we expect the following types and codecs to be exported.
1919
await renderMapContains(renderMap, 'types/myType.ts', [
20-
'export type MyType = LamportsUnsafeBeyond2Pow53Minus1',
20+
'export type MyType = Lamports',
2121
'export type MyTypeArgs = MyType',
2222
'export function getMyTypeEncoder(): Encoder<MyTypeArgs> { return getLamportsEncoder(getU64Encoder()); }',
2323
'export function getMyTypeDecoder(): Decoder<MyType> { return getLamportsDecoder(getU64Decoder()); }',
2424
]);
2525

2626
// And we expect the following type and codec imports.
2727
await renderMapContainsImports(renderMap, 'types/myType.ts', {
28-
'@solana/web3.js': [
29-
'LamportsUnsafeBeyond2Pow53Minus1',
30-
'getLamportsEncoder',
31-
'getLamportsDecoder',
32-
'getU64Encoder',
33-
'getU64Decoder',
34-
],
28+
'@solana/web3.js': ['Lamports', 'getLamportsEncoder', 'getLamportsDecoder', 'getU64Encoder', 'getU64Decoder'],
3529
});
3630
});

0 commit comments

Comments
 (0)