Skip to content

Commit

Permalink
Dropping size to a u32.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Feb 28, 2024
1 parent 401743a commit 8377321
Show file tree
Hide file tree
Showing 25 changed files with 115 additions and 109 deletions.
14 changes: 7 additions & 7 deletions clients/js/src/generated/accounts/pluginHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ import {
gpaBuilder,
publicKey as toPublicKey,
} from '@metaplex-foundation/umi';
import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
import { Serializer, struct, u32 } from '@metaplex-foundation/umi/serializers';
import { Key, KeyArgs, getKeySerializer } from '../types';

export type PluginHeader = Account<PluginHeaderAccountData>;

export type PluginHeaderAccountData = {
key: Key;
pluginRegistryOffset: bigint;
pluginRegistryOffset: number;
};

export type PluginHeaderAccountDataArgs = {
key: KeyArgs;
pluginRegistryOffset: number | bigint;
pluginRegistryOffset: number;
};

export function getPluginHeaderAccountDataSerializer(): Serializer<
Expand All @@ -41,7 +41,7 @@ export function getPluginHeaderAccountDataSerializer(): Serializer<
return struct<PluginHeaderAccountData>(
[
['key', getKeySerializer()],
['pluginRegistryOffset', u64()],
['pluginRegistryOffset', u32()],
],
{ description: 'PluginHeaderAccountData' }
) as Serializer<PluginHeaderAccountDataArgs, PluginHeaderAccountData>;
Expand Down Expand Up @@ -113,15 +113,15 @@ export function getPluginHeaderGpaBuilder(
'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL'
);
return gpaBuilder(context, programId)
.registerFields<{ key: KeyArgs; pluginRegistryOffset: number | bigint }>({
.registerFields<{ key: KeyArgs; pluginRegistryOffset: number }>({
key: [0, getKeySerializer()],
pluginRegistryOffset: [1, u64()],
pluginRegistryOffset: [1, u32()],
})
.deserializeUsing<PluginHeader>((account) =>
deserializePluginHeader(account)
);
}

export function getPluginHeaderSize(): number {
return 9;
return 5;
}
8 changes: 4 additions & 4 deletions clients/js/src/generated/types/externalPluginRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
import { Serializer, struct, u32 } from '@metaplex-foundation/umi/serializers';
import { Authority, AuthorityArgs, getAuthoritySerializer } from '.';

export type ExternalPluginRecord = { authority: Authority; offset: bigint };
export type ExternalPluginRecord = { authority: Authority; offset: number };

export type ExternalPluginRecordArgs = {
authority: AuthorityArgs;
offset: number | bigint;
offset: number;
};

export function getExternalPluginRecordSerializer(): Serializer<
Expand All @@ -23,7 +23,7 @@ export function getExternalPluginRecordSerializer(): Serializer<
return struct<ExternalPluginRecord>(
[
['authority', getAuthoritySerializer()],
['offset', u64()],
['offset', u32()],
],
{ description: 'ExternalPluginRecord' }
) as Serializer<ExternalPluginRecordArgs, ExternalPluginRecord>;
Expand Down
8 changes: 4 additions & 4 deletions clients/js/src/generated/types/registryRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Serializer,
array,
struct,
u64,
u32,
} from '@metaplex-foundation/umi/serializers';
import {
Authority,
Expand All @@ -24,13 +24,13 @@ import {
export type RegistryRecord = {
pluginType: PluginType;
authorities: Array<Authority>;
offset: bigint;
offset: number;
};

export type RegistryRecordArgs = {
pluginType: PluginTypeArgs;
authorities: Array<AuthorityArgs>;
offset: number | bigint;
offset: number;
};

export function getRegistryRecordSerializer(): Serializer<
Expand All @@ -41,7 +41,7 @@ export function getRegistryRecordSerializer(): Serializer<
[
['pluginType', getPluginTypeSerializer()],
['authorities', array(getAuthoritySerializer())],
['offset', u64()],
['offset', u32()],
],
{ description: 'RegistryRecord' }
) as Serializer<RegistryRecordArgs, RegistryRecord>;
Expand Down
4 changes: 2 additions & 2 deletions clients/js/test/addAuthority.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ test('it can add an authority to a plugin', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [
{ __kind: 'Owner' },
{ __kind: 'Pubkey', address: delegateAddress.publicKey },
Expand Down
4 changes: 2 additions & 2 deletions clients/js/test/addPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ test('it can add a plugin to an asset', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down
10 changes: 5 additions & 5 deletions clients/js/test/collectionUpdateDelegate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ test('it can create a new asset with a collection if it is the collection update
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(105),
pluginRegistryOffset: 101,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: PluginType.UpdateDelegate,
offset: BigInt(104),
offset: 100,
authorities: [
{ __kind: 'UpdateAuthority' },
{ __kind: 'Pubkey', address: updateDelegate.publicKey }
Expand Down Expand Up @@ -102,7 +102,7 @@ test('it can create a new asset with a collection if it is the collection update
}).sendAndConfirm(umi);

const asset = await fetchAssetWithPlugins(umi, assetAddress.publicKey);
console.log("Asset State:", asset);
// console.log("Asset State:", asset);
t.like(asset, <AssetWithPlugins>{
publicKey: assetAddress.publicKey,
updateAuthority: umi.identity.publicKey,
Expand All @@ -111,14 +111,14 @@ test('it can create a new asset with a collection if it is the collection update
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(151),
pluginRegistryOffset: 147,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: PluginType.Collection,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'UpdateAuthority' }],
},
],
Expand Down
4 changes: 2 additions & 2 deletions clients/js/test/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ test('it can create a new asset with plugins', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down
12 changes: 6 additions & 6 deletions clients/js/test/createCollection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ test('it can create a new collection with plugins', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(106),
pluginRegistryOffset: 102,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(104),
offset: 100,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down Expand Up @@ -124,14 +124,14 @@ test('it can create a new asset with a collection', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(151),
pluginRegistryOffset: 147,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 5,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'UpdateAuthority' }],
},
],
Expand Down Expand Up @@ -173,14 +173,14 @@ test('it cannot create a new asset with a collection if it is not the collection
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(106),
pluginRegistryOffset: 102,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(104),
offset: 100,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down
8 changes: 4 additions & 4 deletions clients/js/test/delegate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ test('it can delegate a new authority', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [
{ __kind: 'Owner' },
{ __kind: 'Pubkey', address: delegateAddress.publicKey },
Expand Down Expand Up @@ -135,14 +135,14 @@ test('a delegate can freeze the token', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [
{ __kind: 'Owner' },
{ __kind: 'Pubkey', address: delegateAddress.publicKey },
Expand Down
4 changes: 2 additions & 2 deletions clients/js/test/delegateTransfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ test('a delegate can transfer the asset', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(118),
pluginRegistryOffset: 114,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: PluginType.Transfer,
offset: BigInt(117),
offset: 113,
authorities: [
{ __kind: 'Owner' },
{ __kind: 'Pubkey', address: delegateAddress.publicKey },
Expand Down
12 changes: 6 additions & 6 deletions clients/js/test/removeAuthority.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ test('it can remove an authority from a plugin', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [
{ __kind: 'Owner' },
{ __kind: 'Pubkey', address: delegateAddress.publicKey },
Expand Down Expand Up @@ -118,14 +118,14 @@ test('it can remove an authority from a plugin', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down Expand Up @@ -193,14 +193,14 @@ test('it can remove the default authority from a plugin to make it immutable', a
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'None' }],
},
],
Expand Down
6 changes: 3 additions & 3 deletions clients/js/test/removePlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ test('it can remove a plugin from an asset', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(119),
pluginRegistryOffset: 115,
},
pluginRegistry: {
key: 4,
registry: [
{
pluginType: 2,
offset: BigInt(117),
offset: 113,
authorities: [{ __kind: 'Owner' }],
},
],
Expand Down Expand Up @@ -95,7 +95,7 @@ test('it can remove a plugin from an asset', async (t) => {
uri: 'https://example.com/bread',
pluginHeader: {
key: 3,
pluginRegistryOffset: BigInt(117),
pluginRegistryOffset: 113,
},
pluginRegistry: {
key: 4,
Expand Down
Loading

0 comments on commit 8377321

Please sign in to comment.