Skip to content

Commit

Permalink
Merge pull request #200 from atonoy/feature/readable-input-param
Browse files Browse the repository at this point in the history
Feature/readable input param
  • Loading branch information
fukaoi authored Dec 19, 2023
2 parents f8cc5f7 + 5d8b121 commit 7affbff
Show file tree
Hide file tree
Showing 95 changed files with 1,153 additions and 1,089 deletions.
1 change: 0 additions & 1 deletion examples/integration1-regular-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import assert from 'assert';
//////////////////////////////////////////////

const inst1 = await RegularNft.mint(
owner.pubkey,
owner.secret,
{
filePath: asset.filePath!,
Expand Down
1 change: 0 additions & 1 deletion examples/integration10-sbt-mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { requestSol } from 'test-tools';
//////////////////////////////////////////////

const inst1 = await RegularNft.mint(
owner.pubkey,
owner.secret,
{
filePath: asset.filePath!,
Expand Down
4 changes: 0 additions & 4 deletions examples/integration11-compressed-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { requestSol } from 'test-tools';
await sleep(2);

const spaceInst = await CompressedNft.createSpace(
owner.pubkey,
owner.secret,
abountMintTotal,
{ feePayer: feePayer.secret },
Expand All @@ -69,7 +68,6 @@ import { requestSol } from 'test-tools';
console.log('# demo data: ', asset);

const collectionInst = await CompressedNft.mintCollection(
owner.pubkey,
owner.secret,
{
filePath: asset.filePath!,
Expand Down Expand Up @@ -102,7 +100,6 @@ import { requestSol } from 'test-tools';
// Usually set custom param

const mintInst = await CompressedNft.mint(
owner.pubkey,
owner.secret,
{
filePath: asset.filePath!,
Expand Down Expand Up @@ -141,7 +138,6 @@ import { requestSol } from 'test-tools';
//transfer nftReceiver => receipt
const transferInst = await CompressedNft.gasLessTransfer(
mint,
nftReceiver.pubkey,
nftReceiver.secret,
receipt.pubkey,
feePayer.pubkey,
Expand Down
1 change: 0 additions & 1 deletion examples/integration2-spl-token-mint-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import { RandomAsset } from 'test-tools/setupAsset';
isMutable: false,
};
const inst1 = await SplToken.mint(
owner.pubkey,
owner.secret,
totalAmount,
decimals,
Expand Down
10 changes: 2 additions & 8 deletions examples/integration5-token-memo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

import assert from 'assert';
import { Airdrop } from '@solana-suite/airdrop';
import {
Account,
Node,
Pubkey,
SplToken,
} from '@solana-suite/spl-token';
import { Account, Node, Pubkey, SplToken } from '@solana-suite/spl-token';
import { Memo } from '@solana-suite/memo';

import { requestSol } from 'test-tools';
Expand Down Expand Up @@ -51,7 +46,6 @@ import { RandomAsset } from 'test-tools/setupAsset';
};

const inst1 = await SplToken.mint(
owner.pubkey,
owner.secret,
totalAmount,
decimals,
Expand All @@ -73,7 +67,7 @@ import { RandomAsset } from 'test-tools/setupAsset';
how much progress we have made over the past two years — and
how much work remains
`;
const inst2 = Memo.create(memoData, owner.pubkey, owner.secret);
const inst2 = Memo.create(memoData, owner.secret);

(await [inst1, inst2].submit()).match(
async (value) => {
Expand Down
1 change: 0 additions & 1 deletion examples/integration7-transfer-to-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const SLEEP_TIME_WAIT = 0;
};

const inst1 = await SplToken.mint(
owner.pubkey,
owner.secret,
totalAmount,
decimals,
Expand Down
7 changes: 2 additions & 5 deletions examples/integration8-gas-less-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ import { RandomAsset } from 'test-tools/setupAsset';
//////////////////////////////////////////////

const inst = await SolNative.gasLessTransfer(
owner.pubkey,
owner.secret,
dest.pubkey,
[owner.secret],
0.001,
feePayer.pubkey,
);
Expand Down Expand Up @@ -72,7 +71,6 @@ import { RandomAsset } from 'test-tools/setupAsset';
};

const mintInst = await SplToken.mint(
tokenOwner.pubkey,
tokenOwner.secret,
10000,
decimals,
Expand All @@ -84,9 +82,8 @@ import { RandomAsset } from 'test-tools/setupAsset';

const inst2 = await SplToken.gasLessTransfer(
mintInst.unwrap().data as Pubkey,
tokenOwner.pubkey,
tokenOwner.secret,
dest.pubkey,
[tokenOwner.secret],
100,
decimals,
feePayer.pubkey,
Expand Down
1 change: 0 additions & 1 deletion examples/integration9-gas-less-mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { Account, RegularNft } from '@solana-suite/regular-nft';
};

const inst = await RegularNft.gasLessMint(
owner.pubkey,
owner.secret,
metadata,
feePayer.pubkey,
Expand Down
8 changes: 1 addition & 7 deletions packages/account/test/associated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ test.before(async () => {
});

test('Retry getOrCreate', async (t) => {
const mintInst = await SplToken.mint(
source.pubkey,
source.secret,
10000,
1,
TOKEN_METADATA,
);
const mintInst = await SplToken.mint(source.secret, 10000, 1, TOKEN_METADATA);

await mintInst.submit();

Expand Down
7 changes: 7 additions & 0 deletions packages/suite-airdrop/dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ type AirdropOptions = {
};

declare namespace Airdrop {
/**
* Reuqest airdrop SOL
* only devnet, testnet
*
* @param {Pubkey} pubkey
* @return Promise<Result<string, Error>>
*/
const request: (pubkey: Pubkey, options?: Partial<AirdropOptions>) => Promise<Result<string, Error>>;
}

Expand Down
7 changes: 7 additions & 0 deletions packages/suite-airdrop/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ type AirdropOptions = {
};

declare namespace Airdrop {
/**
* Reuqest airdrop SOL
* only devnet, testnet
*
* @param {Pubkey} pubkey
* @return Promise<Result<string, Error>>
*/
const request: (pubkey: Pubkey, options?: Partial<AirdropOptions>) => Promise<Result<string, Error>>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/suite-airdrop/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/suite-airdrop/dist/index.mjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/suite-airdrop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export namespace Airdrop {
const DEFAULT_AIRDROP_AMOUNT = 1;
const MAX_AIRDROP_SOL = 2;

/**
* Reuqest airdrop SOL
* only devnet, testnet
*
* @param {Pubkey} pubkey
* @return Promise<Result<string, Error>>
*/
export const request = async (
pubkey: Pubkey,
options: Partial<AirdropOptions> = {},
Expand Down
26 changes: 12 additions & 14 deletions packages/suite-compressed-nft/dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -730,27 +730,25 @@ declare namespace CompressedNft$1 {
* create a new markle tree
* This function needs only 1 call
*
* @param {Pubkey} owner
* @param {Secret} signer
* @param {Secret} owner
* @param {number} maxDepth
* @param {number} maxBufferSize
* @param {number} canopyDepth
* @param {Partial<SpaceOptions>} options
* @return Promise<Result<MintTransaction, Error>>
*/
const initSpace: (owner: Pubkey$1, signer: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
const initSpace: (owner: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
/**
* create a new nft space
* This function needs only 1 call
*
* @param {Pubkey} owner
* @param {Secret} signer
* @param {Secret} owner
* @param {number} spaceSize
* @param {Partial<SpaceOptions>} options
*
* @return Promise<Result<MintTransaction, Error>>
*/
const createSpace: (owner: Pubkey$1, signer: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
const createSpace: (owner: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
/**
* Calculate space cost
*
Expand All @@ -764,24 +762,24 @@ declare namespace CompressedNft$1 {

declare const CompressedNft: {
createTransfer: (assetId: Pubkey$1, assetIdOwner: Pubkey$1, dest: Pubkey$1, delegate?: Pubkey$1 | undefined) => Promise<_solana_web3_js.TransactionInstruction>;
transfer: (assetId: Pubkey$1, assetIdOwner: Pubkey$1, dest: Pubkey$1, signers: Secret[]) => Promise<Result<CommonStructure, Error>>;
mintCollection: (owner: Pubkey$1, signer: Secret$1, input: InputNftMetadata, options?: Partial<MintCollectionOptions>) => Promise<Result<MintStructure, Error>>;
transfer: (mint: Pubkey$1, owner: Pubkey$1, dest: Pubkey$1, ownerOrMultisig: Secret[]) => Promise<Result<CommonStructure, Error>>;
mintCollection: (owner: Secret$1, input: InputNftMetadata, options?: Partial<MintCollectionOptions>) => Promise<Result<MintStructure, Error>>;
Space: typeof CompressedNft$1.Space;
initSpace: (owner: Pubkey$1, signer: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
createSpace: (owner: Pubkey$1, signer: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
initSpace: (owner: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
createSpace: (owner: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
calculateSpaceCost: (spaceSize: number) => Promise<{
sol: number;
}>;
createVerifyCreator: (creators: mpl_bubblegum_instruction.Creator[], assetId: _solana_web3_js.PublicKey, treeOwner: _solana_web3_js.PublicKey, metadata: mpl_bubblegum_instruction.MetadataArgs, feePayer: _solana_web3_js.PublicKey) => Promise<_solana_web3_js.TransactionInstruction>;
mint: (owner: Pubkey$1, signer: Secret$1, input: InputNftMetadata, treeOwner: Pubkey$1, collectionMint: Pubkey$1, options?: Partial<MintOptions>) => Promise<Result<MintStructure<CompressedNft$1.Space>, Error>>;
gasLessTransfer: (mint: Pubkey$1, owner: Pubkey$1, signer: Secret$1, dest: Pubkey$1, feePayer: Pubkey$1) => Promise<Result<PartialSignStructure, Error>[]>;
gasLessDelegate: (assetId: Pubkey$1, assetIdOwner: Secret$1, newDelegate: Pubkey$1) => Promise<Result<PartialSignStructure, Error>>;
mint: (owner: Secret$1, input: InputNftMetadata, treeOwner: Pubkey$1, collectionMint: Pubkey$1, options?: Partial<MintOptions>) => Promise<Result<MintStructure<CompressedNft$1.Space>, Error>>;
gasLessTransfer: (mint: Pubkey$1, owner: Secret$1, dest: Pubkey$1, feePayer: Pubkey$1) => Promise<Result<PartialSignStructure, Error>[]>;
gasLessDelegate: (mint: Pubkey$1, owner: Secret$1, newDelegate: Pubkey$1) => Promise<Result<PartialSignStructure, Error>>;
defaultSortBy: Sortable;
findByOwner: (owner: Pubkey, options?: Partial<FindOptions>) => Promise<Result<CompressedNftMetadata, Error>>;
findByMint: (mint: Pubkey) => Promise<Result<NftMetadata, Error>>;
findByCollection: (collectionMint: Pubkey, options?: Partial<FindOptions>) => Promise<Result<CompressedNftMetadata, Error>>;
createDeleagate: (assetId: _solana_web3_js.PublicKey, newDelegate: _solana_web3_js.PublicKey | null) => Promise<_solana_web3_js.TransactionInstruction>;
setDelegate: (assetId: Pubkey$1, signer: Secret$1, options?: Partial<DelegateOptions>) => Promise<Result<CommonStructure, Error>>;
setDelegate: (mint: Pubkey$1, owner: Secret$1, options?: Partial<DelegateOptions>) => Promise<Result<CommonStructure, Error>>;
};

export { Account, CompressedNft, Explorer, ExplorerOptions, FilterOptions, FilterType, KeypairAccount, Memo, MintTo, MintToChecked, ModuleName, Node, OwnerInfo, PostTokenAccount, Pubkey$1 as Pubkey, Secret$1 as Secret, Transfer, TransferChecked, Try, Validator, ValidatorError, WithMemo, bufferToArray, convertTimestampToDateTime, debugLog, isBrowser, isNode, isPromise, overwriteObject, sleep, unixTimestamp };
26 changes: 12 additions & 14 deletions packages/suite-compressed-nft/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,27 +730,25 @@ declare namespace CompressedNft$1 {
* create a new markle tree
* This function needs only 1 call
*
* @param {Pubkey} owner
* @param {Secret} signer
* @param {Secret} owner
* @param {number} maxDepth
* @param {number} maxBufferSize
* @param {number} canopyDepth
* @param {Partial<SpaceOptions>} options
* @return Promise<Result<MintTransaction, Error>>
*/
const initSpace: (owner: Pubkey$1, signer: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
const initSpace: (owner: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
/**
* create a new nft space
* This function needs only 1 call
*
* @param {Pubkey} owner
* @param {Secret} signer
* @param {Secret} owner
* @param {number} spaceSize
* @param {Partial<SpaceOptions>} options
*
* @return Promise<Result<MintTransaction, Error>>
*/
const createSpace: (owner: Pubkey$1, signer: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
const createSpace: (owner: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
/**
* Calculate space cost
*
Expand All @@ -764,24 +762,24 @@ declare namespace CompressedNft$1 {

declare const CompressedNft: {
createTransfer: (assetId: Pubkey$1, assetIdOwner: Pubkey$1, dest: Pubkey$1, delegate?: Pubkey$1 | undefined) => Promise<_solana_web3_js.TransactionInstruction>;
transfer: (assetId: Pubkey$1, assetIdOwner: Pubkey$1, dest: Pubkey$1, signers: Secret[]) => Promise<Result<CommonStructure, Error>>;
mintCollection: (owner: Pubkey$1, signer: Secret$1, input: InputNftMetadata, options?: Partial<MintCollectionOptions>) => Promise<Result<MintStructure, Error>>;
transfer: (mint: Pubkey$1, owner: Pubkey$1, dest: Pubkey$1, ownerOrMultisig: Secret[]) => Promise<Result<CommonStructure, Error>>;
mintCollection: (owner: Secret$1, input: InputNftMetadata, options?: Partial<MintCollectionOptions>) => Promise<Result<MintStructure, Error>>;
Space: typeof CompressedNft$1.Space;
initSpace: (owner: Pubkey$1, signer: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
createSpace: (owner: Pubkey$1, signer: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
initSpace: (owner: Secret, maxDepth: number, maxBufferSize: number, canopyDepth: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
createSpace: (owner: Secret, spaceSize: number, options?: Partial<SpaceOptions>) => Promise<Result<MintStructure, Error>>;
calculateSpaceCost: (spaceSize: number) => Promise<{
sol: number;
}>;
createVerifyCreator: (creators: mpl_bubblegum_instruction.Creator[], assetId: _solana_web3_js.PublicKey, treeOwner: _solana_web3_js.PublicKey, metadata: mpl_bubblegum_instruction.MetadataArgs, feePayer: _solana_web3_js.PublicKey) => Promise<_solana_web3_js.TransactionInstruction>;
mint: (owner: Pubkey$1, signer: Secret$1, input: InputNftMetadata, treeOwner: Pubkey$1, collectionMint: Pubkey$1, options?: Partial<MintOptions>) => Promise<Result<MintStructure<CompressedNft$1.Space>, Error>>;
gasLessTransfer: (mint: Pubkey$1, owner: Pubkey$1, signer: Secret$1, dest: Pubkey$1, feePayer: Pubkey$1) => Promise<Result<PartialSignStructure, Error>[]>;
gasLessDelegate: (assetId: Pubkey$1, assetIdOwner: Secret$1, newDelegate: Pubkey$1) => Promise<Result<PartialSignStructure, Error>>;
mint: (owner: Secret$1, input: InputNftMetadata, treeOwner: Pubkey$1, collectionMint: Pubkey$1, options?: Partial<MintOptions>) => Promise<Result<MintStructure<CompressedNft$1.Space>, Error>>;
gasLessTransfer: (mint: Pubkey$1, owner: Secret$1, dest: Pubkey$1, feePayer: Pubkey$1) => Promise<Result<PartialSignStructure, Error>[]>;
gasLessDelegate: (mint: Pubkey$1, owner: Secret$1, newDelegate: Pubkey$1) => Promise<Result<PartialSignStructure, Error>>;
defaultSortBy: Sortable;
findByOwner: (owner: Pubkey, options?: Partial<FindOptions>) => Promise<Result<CompressedNftMetadata, Error>>;
findByMint: (mint: Pubkey) => Promise<Result<NftMetadata, Error>>;
findByCollection: (collectionMint: Pubkey, options?: Partial<FindOptions>) => Promise<Result<CompressedNftMetadata, Error>>;
createDeleagate: (assetId: _solana_web3_js.PublicKey, newDelegate: _solana_web3_js.PublicKey | null) => Promise<_solana_web3_js.TransactionInstruction>;
setDelegate: (assetId: Pubkey$1, signer: Secret$1, options?: Partial<DelegateOptions>) => Promise<Result<CommonStructure, Error>>;
setDelegate: (mint: Pubkey$1, owner: Secret$1, options?: Partial<DelegateOptions>) => Promise<Result<CommonStructure, Error>>;
};

export { Account, CompressedNft, Explorer, ExplorerOptions, FilterOptions, FilterType, KeypairAccount, Memo, MintTo, MintToChecked, ModuleName, Node, OwnerInfo, PostTokenAccount, Pubkey$1 as Pubkey, Secret$1 as Secret, Transfer, TransferChecked, Try, Validator, ValidatorError, WithMemo, bufferToArray, convertTimestampToDateTime, debugLog, isBrowser, isNode, isPromise, overwriteObject, sleep, unixTimestamp };
Loading

0 comments on commit 7affbff

Please sign in to comment.