Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping size to a u32. #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading