Compare commits
23 Commits
develop
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae3dad0aaf | ||
|
|
7ad9d755eb | ||
|
|
7bdf81d95e | ||
|
|
c5dbc5c855 | ||
|
|
5e28d7dfb0 | ||
|
|
71c273c4ef | ||
|
|
2f681bbcba | ||
|
|
03ddc13911 | ||
|
|
2f3065dca2 | ||
|
|
32f4157c42 | ||
|
|
dc902313a6 | ||
|
|
35e736062a | ||
|
|
e64073499d | ||
|
|
019a0c4d73 | ||
|
|
129953f7b3 | ||
|
|
6f36284fbd | ||
|
|
f4f11dbe6a | ||
|
|
07a08ca35a | ||
|
|
eb82d10140 | ||
|
|
9eab06738b | ||
|
|
fc65053978 | ||
|
|
fae92e5483 | ||
|
|
2340657020 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -1 +1 @@
|
|||||||
* @findolor @MightOfOaks @name-user1
|
* @MightOfOaks @Ninjatosba
|
||||||
|
|||||||
@ -16,6 +16,11 @@ export const sg721LinkTabs: LinkTabProps[] = [
|
|||||||
description: `Execute SG721 contract actions`,
|
description: `Execute SG721 contract actions`,
|
||||||
href: '/contracts/sg721/execute',
|
href: '/contracts/sg721/execute',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Migrate',
|
||||||
|
description: `Migrate SG721 contract`,
|
||||||
|
href: '/contracts/sg721/migrate',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export const minterLinkTabs: LinkTabProps[] = [
|
export const minterLinkTabs: LinkTabProps[] = [
|
||||||
@ -34,6 +39,11 @@ export const minterLinkTabs: LinkTabProps[] = [
|
|||||||
description: `Execute Minter contract actions`,
|
description: `Execute Minter contract actions`,
|
||||||
href: '/contracts/minter/execute',
|
href: '/contracts/minter/execute',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Migrate',
|
||||||
|
description: `Migrate Minter contract`,
|
||||||
|
href: '/contracts/minter/migrate',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export const whitelistLinkTabs: LinkTabProps[] = [
|
export const whitelistLinkTabs: LinkTabProps[] = [
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
import { AirdropUpload } from 'components/AirdropUpload'
|
import { AirdropUpload } from 'components/AirdropUpload'
|
||||||
import { Button } from 'components/Button'
|
import { Button } from 'components/Button'
|
||||||
import type { DispatchExecuteArgs } from 'components/collections/actions/actions'
|
import type { DispatchExecuteArgs } from 'components/collections/actions/actions'
|
||||||
@ -83,6 +84,22 @@ export const CollectionActions = ({
|
|||||||
subtitle: 'Address of the recipient',
|
subtitle: 'Address of the recipient',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const tokenURIState = useInputState({
|
||||||
|
id: 'token-uri',
|
||||||
|
name: 'tokenURI',
|
||||||
|
title: 'Token URI',
|
||||||
|
subtitle: 'URI for the token',
|
||||||
|
placeholder: 'ipfs://',
|
||||||
|
})
|
||||||
|
|
||||||
|
const baseURIState = useInputState({
|
||||||
|
id: 'base-uri',
|
||||||
|
name: 'baseURI',
|
||||||
|
title: 'Base URI',
|
||||||
|
subtitle: 'Base URI to batch update token metadata with',
|
||||||
|
placeholder: 'ipfs://',
|
||||||
|
})
|
||||||
|
|
||||||
const whitelistState = useInputState({
|
const whitelistState = useInputState({
|
||||||
id: 'whitelist-address',
|
id: 'whitelist-address',
|
||||||
name: 'whitelistAddress',
|
name: 'whitelistAddress',
|
||||||
@ -90,14 +107,33 @@ export const CollectionActions = ({
|
|||||||
subtitle: 'Address of the whitelist contract',
|
subtitle: 'Address of the whitelist contract',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const royaltyPaymentAddressState = useInputState({
|
||||||
|
id: 'royalty-payment-address',
|
||||||
|
name: 'royaltyPaymentAddress',
|
||||||
|
title: 'Royalty Payment Address',
|
||||||
|
subtitle: 'Address to receive royalties.',
|
||||||
|
placeholder: 'stars1234567890abcdefghijklmnopqrstuvwxyz...',
|
||||||
|
})
|
||||||
|
|
||||||
|
const royaltyShareState = useInputState({
|
||||||
|
id: 'royalty-share',
|
||||||
|
name: 'royaltyShare',
|
||||||
|
title: 'Share Percentage',
|
||||||
|
subtitle: 'Percentage of royalties to be paid',
|
||||||
|
placeholder: '8%',
|
||||||
|
})
|
||||||
|
|
||||||
const showWhitelistField = type === 'set_whitelist'
|
const showWhitelistField = type === 'set_whitelist'
|
||||||
const showDateField = type === 'update_start_time'
|
const showDateField = type === 'update_start_time'
|
||||||
const showLimitField = type === 'update_per_address_limit'
|
const showLimitField = type === 'update_per_address_limit'
|
||||||
const showTokenIdField = isEitherType(type, ['transfer', 'mint_for', 'burn'])
|
const showTokenIdField = isEitherType(type, ['transfer', 'mint_for', 'burn', 'update_token_metadata'])
|
||||||
const showNumberOfTokensField = type === 'batch_mint'
|
const showNumberOfTokensField = type === 'batch_mint'
|
||||||
const showTokenIdListField = isEitherType(type, ['batch_burn', 'batch_transfer'])
|
const showTokenIdListField = isEitherType(type, ['batch_burn', 'batch_transfer', 'batch_update_token_metadata'])
|
||||||
const showRecipientField = isEitherType(type, ['transfer', 'mint_to', 'mint_for', 'batch_mint', 'batch_transfer'])
|
const showRecipientField = isEitherType(type, ['transfer', 'mint_to', 'mint_for', 'batch_mint', 'batch_transfer'])
|
||||||
const showAirdropFileField = type === 'airdrop'
|
const showAirdropFileField = type === 'airdrop'
|
||||||
|
const showRoyaltyInfoFields = type === 'update_royalty_info'
|
||||||
|
const showTokenUriField = type === 'update_token_metadata'
|
||||||
|
const showBaseUriField = type === 'batch_update_token_metadata'
|
||||||
|
|
||||||
const payload: DispatchExecuteArgs = {
|
const payload: DispatchExecuteArgs = {
|
||||||
whitelist: whitelistState.value,
|
whitelist: whitelistState.value,
|
||||||
@ -113,6 +149,16 @@ export const CollectionActions = ({
|
|||||||
recipient: recipientState.value,
|
recipient: recipientState.value,
|
||||||
recipients: airdropArray,
|
recipients: airdropArray,
|
||||||
txSigner: wallet.address,
|
txSigner: wallet.address,
|
||||||
|
royaltyInfo: {
|
||||||
|
payment_address: royaltyPaymentAddressState.value,
|
||||||
|
share_bps: Number(royaltyShareState.value),
|
||||||
|
},
|
||||||
|
baseUri: baseURIState.value.trim().endsWith('/')
|
||||||
|
? baseURIState.value.trim().slice(0, -1)
|
||||||
|
: baseURIState.value.trim(),
|
||||||
|
tokenUri: tokenURIState.value.trim().endsWith('/')
|
||||||
|
? tokenURIState.value.trim().slice(0, -1)
|
||||||
|
: tokenURIState.value.trim(),
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,9 +186,42 @@ export const CollectionActions = ({
|
|||||||
if (minterContractAddress === '' && sg721ContractAddress === '') {
|
if (minterContractAddress === '' && sg721ContractAddress === '') {
|
||||||
throw new Error('Please enter minter and sg721 contract addresses!')
|
throw new Error('Please enter minter and sg721 contract addresses!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
type === 'update_royalty_info' &&
|
||||||
|
(royaltyShareState.value ? !royaltyPaymentAddressState.value : royaltyPaymentAddressState.value)
|
||||||
|
) {
|
||||||
|
throw new Error('Royalty payment address and share percentage are both required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
type === 'update_royalty_info' &&
|
||||||
|
royaltyPaymentAddressState.value &&
|
||||||
|
!royaltyPaymentAddressState.value.trim().endsWith('.stars')
|
||||||
|
) {
|
||||||
|
const contractInfoResponse = await wallet.client
|
||||||
|
?.queryContractRaw(
|
||||||
|
royaltyPaymentAddressState.value.trim(),
|
||||||
|
toUtf8(Buffer.from(Buffer.from('contract_info').toString('hex'), 'hex').toString()),
|
||||||
|
)
|
||||||
|
.catch((e) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
|
if (e.message.includes('bech32')) throw new Error('Invalid royalty payment address.')
|
||||||
|
console.log(e.message)
|
||||||
|
})
|
||||||
|
if (contractInfoResponse !== undefined) {
|
||||||
|
const contractInfo = JSON.parse(new TextDecoder().decode(contractInfoResponse as Uint8Array))
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
|
if (contractInfo && (contractInfo.contract.includes('minter') || contractInfo.contract.includes('sg721')))
|
||||||
|
throw new Error('The provided royalty payment address does not belong to a compatible contract.')
|
||||||
|
else console.log(contractInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const txHash = await toast.promise(dispatchExecute(payload), {
|
const txHash = await toast.promise(dispatchExecute(payload), {
|
||||||
error: `${type.charAt(0).toUpperCase() + type.slice(1)} execute failed!`,
|
error: `${type.charAt(0).toUpperCase() + type.slice(1)} execute failed!`,
|
||||||
loading: 'Executing message...',
|
loading: 'Executing message...',
|
||||||
|
|
||||||
success: (tx) => `Transaction ${tx} success!`,
|
success: (tx) => `Transaction ${tx} success!`,
|
||||||
})
|
})
|
||||||
if (txHash) {
|
if (txHash) {
|
||||||
@ -151,7 +230,7 @@ export const CollectionActions = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error(String(error))
|
toast.error(String(error), { style: { maxWidth: 'none' } })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -170,8 +249,12 @@ export const CollectionActions = ({
|
|||||||
{showWhitelistField && <AddressInput {...whitelistState} />}
|
{showWhitelistField && <AddressInput {...whitelistState} />}
|
||||||
{showLimitField && <NumberInput {...limitState} />}
|
{showLimitField && <NumberInput {...limitState} />}
|
||||||
{showTokenIdField && <NumberInput {...tokenIdState} />}
|
{showTokenIdField && <NumberInput {...tokenIdState} />}
|
||||||
|
{showTokenUriField && <TextInput className="mt-2" {...tokenURIState} />}
|
||||||
{showTokenIdListField && <TextInput {...tokenIdListState} />}
|
{showTokenIdListField && <TextInput {...tokenIdListState} />}
|
||||||
|
{showBaseUriField && <TextInput className="mt-2" {...baseURIState} />}
|
||||||
{showNumberOfTokensField && <NumberInput {...batchNumberState} />}
|
{showNumberOfTokensField && <NumberInput {...batchNumberState} />}
|
||||||
|
{showRoyaltyInfoFields && <TextInput className="mt-2" {...royaltyPaymentAddressState} />}
|
||||||
|
{showRoyaltyInfoFields && <NumberInput className="mt-2" {...royaltyShareState} />}
|
||||||
{showAirdropFileField && (
|
{showAirdropFileField && (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
subtitle="CSV file that contains the airdrop addresses and the amount of tokens allocated for each address. Should start with the following header row: address,amount"
|
subtitle="CSV file that contains the airdrop addresses and the amount of tokens allocated for each address. Should start with the following header row: address,amount"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { MinterInstance } from 'contracts/minter'
|
import type { MinterInstance } from 'contracts/minter'
|
||||||
import { useMinterContract } from 'contracts/minter'
|
import { useMinterContract } from 'contracts/minter'
|
||||||
import type { SG721Instance } from 'contracts/sg721'
|
import type { RoyaltyInfo, SG721Instance } from 'contracts/sg721'
|
||||||
import { useSG721Contract } from 'contracts/sg721'
|
import { useSG721Contract } from 'contracts/sg721'
|
||||||
|
|
||||||
export type ActionType = typeof ACTION_TYPES[number]
|
export type ActionType = typeof ACTION_TYPES[number]
|
||||||
@ -11,6 +11,7 @@ export const ACTION_TYPES = [
|
|||||||
'batch_mint',
|
'batch_mint',
|
||||||
'set_whitelist',
|
'set_whitelist',
|
||||||
'update_start_time',
|
'update_start_time',
|
||||||
|
'update_royalty_info',
|
||||||
'update_per_address_limit',
|
'update_per_address_limit',
|
||||||
'withdraw',
|
'withdraw',
|
||||||
'transfer',
|
'transfer',
|
||||||
@ -19,6 +20,9 @@ export const ACTION_TYPES = [
|
|||||||
'batch_burn',
|
'batch_burn',
|
||||||
'shuffle',
|
'shuffle',
|
||||||
'airdrop',
|
'airdrop',
|
||||||
|
'update_token_metadata',
|
||||||
|
'batch_update_token_metadata',
|
||||||
|
'freeze_token_metadata',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export interface ActionListItem {
|
export interface ActionListItem {
|
||||||
@ -48,6 +52,11 @@ export const ACTION_LIST: ActionListItem[] = [
|
|||||||
name: 'Set Whitelist',
|
name: 'Set Whitelist',
|
||||||
description: `Set whitelist contract address`,
|
description: `Set whitelist contract address`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'update_royalty_info',
|
||||||
|
name: 'Update Royalty Info',
|
||||||
|
description: `Update royalty payment details`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'update_start_time',
|
id: 'update_start_time',
|
||||||
name: 'Update Start Time',
|
name: 'Update Start Time',
|
||||||
@ -58,6 +67,21 @@ export const ACTION_LIST: ActionListItem[] = [
|
|||||||
name: 'Update Tokens Per Address Limit',
|
name: 'Update Tokens Per Address Limit',
|
||||||
description: `Update token per address limit`,
|
description: `Update token per address limit`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'update_token_metadata',
|
||||||
|
name: 'Update Token Metadata',
|
||||||
|
description: `Update the metadata URI for a token`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'batch_update_token_metadata',
|
||||||
|
name: 'Batch Update Token Metadata',
|
||||||
|
description: `Update the metadata URI for a range of tokens`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'freeze_token_metadata',
|
||||||
|
name: 'Freeze Token Metadata',
|
||||||
|
description: `Render the metadata for tokens no longer updatable`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'withdraw',
|
id: 'withdraw',
|
||||||
name: 'Withdraw Tokens',
|
name: 'Withdraw Tokens',
|
||||||
@ -123,7 +147,11 @@ export type DispatchExecuteArgs = {
|
|||||||
| { type: Select<'batch_transfer'>; recipient: string; tokenIds: string }
|
| { type: Select<'batch_transfer'>; recipient: string; tokenIds: string }
|
||||||
| { type: Select<'burn'>; tokenId: number }
|
| { type: Select<'burn'>; tokenId: number }
|
||||||
| { type: Select<'batch_burn'>; tokenIds: string }
|
| { type: Select<'batch_burn'>; tokenIds: string }
|
||||||
|
| { type: Select<'update_royalty_info'>; royaltyInfo: RoyaltyInfo }
|
||||||
| { type: Select<'airdrop'>; recipients: string[] }
|
| { type: Select<'airdrop'>; recipients: string[] }
|
||||||
|
| { type: Select<'update_token_metadata'>; tokenId: number; tokenUri: string }
|
||||||
|
| { type: Select<'batch_update_token_metadata'>; tokenIds: string; baseUri: string }
|
||||||
|
| { type: Select<'freeze_token_metadata'> }
|
||||||
)
|
)
|
||||||
|
|
||||||
export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
||||||
@ -165,12 +193,24 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
|||||||
case 'burn': {
|
case 'burn': {
|
||||||
return sg721Messages.burn(args.tokenId.toString())
|
return sg721Messages.burn(args.tokenId.toString())
|
||||||
}
|
}
|
||||||
|
case 'update_royalty_info': {
|
||||||
|
return sg721Messages.updateRoyaltyInfo(args.royaltyInfo)
|
||||||
|
}
|
||||||
case 'batch_burn': {
|
case 'batch_burn': {
|
||||||
return sg721Messages.batchBurn(args.tokenIds)
|
return sg721Messages.batchBurn(args.tokenIds)
|
||||||
}
|
}
|
||||||
case 'airdrop': {
|
case 'airdrop': {
|
||||||
return minterMessages.airdrop(txSigner, args.recipients)
|
return minterMessages.airdrop(txSigner, args.recipients)
|
||||||
}
|
}
|
||||||
|
case 'update_token_metadata': {
|
||||||
|
return sg721Messages.updateTokenMetadata(args.tokenId.toString(), args.tokenUri)
|
||||||
|
}
|
||||||
|
case 'batch_update_token_metadata': {
|
||||||
|
return sg721Messages.batchUpdateTokenMetadata(args.tokenIds, args.baseUri)
|
||||||
|
}
|
||||||
|
case 'freeze_token_metadata': {
|
||||||
|
return sg721Messages.freezeTokenMetadata()
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error('Unknown action')
|
throw new Error('Unknown action')
|
||||||
}
|
}
|
||||||
@ -208,6 +248,15 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
|
|||||||
case 'withdraw': {
|
case 'withdraw': {
|
||||||
return minterMessages(minterContract)?.withdraw()
|
return minterMessages(minterContract)?.withdraw()
|
||||||
}
|
}
|
||||||
|
case 'update_token_metadata': {
|
||||||
|
return sg721Messages(sg721Contract)?.updateTokenMetadata(args.tokenId.toString(), args.tokenUri)
|
||||||
|
}
|
||||||
|
case 'batch_update_token_metadata': {
|
||||||
|
return sg721Messages(sg721Contract)?.batchUpdateTokenMetadata(args.tokenIds, args.baseUri)
|
||||||
|
}
|
||||||
|
case 'freeze_token_metadata': {
|
||||||
|
return sg721Messages(sg721Contract)?.freezeTokenMetadata()
|
||||||
|
}
|
||||||
case 'transfer': {
|
case 'transfer': {
|
||||||
return sg721Messages(sg721Contract)?.transferNft(args.recipient, args.tokenId.toString())
|
return sg721Messages(sg721Contract)?.transferNft(args.recipient, args.tokenId.toString())
|
||||||
}
|
}
|
||||||
@ -217,6 +266,9 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
|
|||||||
case 'burn': {
|
case 'burn': {
|
||||||
return sg721Messages(sg721Contract)?.burn(args.tokenId.toString())
|
return sg721Messages(sg721Contract)?.burn(args.tokenId.toString())
|
||||||
}
|
}
|
||||||
|
case 'update_royalty_info': {
|
||||||
|
return sg721Messages(sg721Contract)?.updateRoyaltyInfo(args.royaltyInfo)
|
||||||
|
}
|
||||||
case 'batch_burn': {
|
case 'batch_burn': {
|
||||||
return sg721Messages(sg721Contract)?.batchBurn(args.tokenIds)
|
return sg721Messages(sg721Contract)?.batchBurn(args.tokenIds)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,11 @@ export interface InstantiateResponse {
|
|||||||
readonly logs: readonly logs.Log[]
|
readonly logs: readonly logs.Log[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MigrateResponse {
|
||||||
|
readonly transactionHash: string
|
||||||
|
readonly logs: readonly logs.Log[]
|
||||||
|
}
|
||||||
|
|
||||||
export interface RoyalityInfo {
|
export interface RoyalityInfo {
|
||||||
payment_address: string
|
payment_address: string
|
||||||
share: string
|
share: string
|
||||||
@ -38,6 +43,8 @@ export interface MinterInstance {
|
|||||||
shuffle: (senderAddress: string) => Promise<string>
|
shuffle: (senderAddress: string) => Promise<string>
|
||||||
withdraw: (senderAddress: string) => Promise<string>
|
withdraw: (senderAddress: string) => Promise<string>
|
||||||
airdrop: (senderAddress: string, recipients: string[]) => Promise<string>
|
airdrop: (senderAddress: string, recipients: string[]) => Promise<string>
|
||||||
|
updateDiscountPrice: (senderAddress: string, price: string) => Promise<string>
|
||||||
|
removeDiscountPrice: (senderAddress: string) => Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MinterMessages {
|
export interface MinterMessages {
|
||||||
@ -51,6 +58,26 @@ export interface MinterMessages {
|
|||||||
shuffle: () => ShuffleMessage
|
shuffle: () => ShuffleMessage
|
||||||
withdraw: () => WithdrawMessage
|
withdraw: () => WithdrawMessage
|
||||||
airdrop: (recipients: string[]) => CustomMessage
|
airdrop: (recipients: string[]) => CustomMessage
|
||||||
|
updateDiscountPrice: (price: string) => UpdateDiscountPriceMessage
|
||||||
|
removeDiscountPrice: () => RemoveDiscountPriceMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateDiscountPriceMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: {
|
||||||
|
update_discount_price: Record<string, unknown>
|
||||||
|
}
|
||||||
|
funds: Coin[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RemoveDiscountPriceMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: {
|
||||||
|
remove_discount_price: Record<string, never>
|
||||||
|
}
|
||||||
|
funds: Coin[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MintMessage {
|
export interface MintMessage {
|
||||||
@ -151,6 +178,13 @@ export interface MinterContract {
|
|||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<InstantiateResponse>
|
) => Promise<InstantiateResponse>
|
||||||
|
|
||||||
|
migrate: (
|
||||||
|
senderAddress: string,
|
||||||
|
contractAddress: string,
|
||||||
|
codeId: number,
|
||||||
|
migrateMsg: Record<string, unknown>,
|
||||||
|
) => Promise<MigrateResponse>
|
||||||
|
|
||||||
use: (contractAddress: string) => MinterInstance
|
use: (contractAddress: string) => MinterInstance
|
||||||
|
|
||||||
messages: (contractAddress: string) => MinterMessages
|
messages: (contractAddress: string) => MinterMessages
|
||||||
@ -354,6 +388,35 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
|
|||||||
return res.transactionHash
|
return res.transactionHash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateDiscountPrice = async (senderAddress: string, price: string): Promise<string> => {
|
||||||
|
const res = await client.execute(
|
||||||
|
senderAddress,
|
||||||
|
contractAddress,
|
||||||
|
{
|
||||||
|
update_discount_price: {
|
||||||
|
price,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'auto',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeDiscountPrice = async (senderAddress: string): Promise<string> => {
|
||||||
|
const res = await client.execute(
|
||||||
|
senderAddress,
|
||||||
|
contractAddress,
|
||||||
|
{
|
||||||
|
remove_discount_price: {},
|
||||||
|
},
|
||||||
|
'auto',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
contractAddress,
|
contractAddress,
|
||||||
getConfig,
|
getConfig,
|
||||||
@ -371,6 +434,21 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
|
|||||||
airdrop,
|
airdrop,
|
||||||
shuffle,
|
shuffle,
|
||||||
withdraw,
|
withdraw,
|
||||||
|
updateDiscountPrice,
|
||||||
|
removeDiscountPrice,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const migrate = async (
|
||||||
|
senderAddress: string,
|
||||||
|
contractAddress: string,
|
||||||
|
codeId: number,
|
||||||
|
migrateMsg: Record<string, unknown>,
|
||||||
|
): Promise<MigrateResponse> => {
|
||||||
|
const result = await client.migrate(senderAddress, contractAddress, codeId, migrateMsg, 'auto')
|
||||||
|
return {
|
||||||
|
transactionHash: result.transactionHash,
|
||||||
|
logs: result.logs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,6 +592,28 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
|
|||||||
funds: [],
|
funds: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const updateDiscountPrice = (price: string): UpdateDiscountPriceMessage => {
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: {
|
||||||
|
update_discount_price: {
|
||||||
|
price,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const removeDiscountPrice = (): RemoveDiscountPriceMessage => {
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: {
|
||||||
|
remove_discount_price: {},
|
||||||
|
},
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mint,
|
mint,
|
||||||
@ -526,8 +626,10 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
|
|||||||
airdrop,
|
airdrop,
|
||||||
shuffle,
|
shuffle,
|
||||||
withdraw,
|
withdraw,
|
||||||
|
updateDiscountPrice,
|
||||||
|
removeDiscountPrice,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { use, instantiate, messages }
|
return { use, instantiate, messages, migrate }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ export const EXECUTE_TYPES = [
|
|||||||
'mint_for',
|
'mint_for',
|
||||||
'shuffle',
|
'shuffle',
|
||||||
'withdraw',
|
'withdraw',
|
||||||
|
'update_discount_price',
|
||||||
|
'remove_discount_price',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export interface ExecuteListItem {
|
export interface ExecuteListItem {
|
||||||
@ -56,6 +58,16 @@ export const EXECUTE_LIST: ExecuteListItem[] = [
|
|||||||
name: 'Shuffle',
|
name: 'Shuffle',
|
||||||
description: `Shuffle the token IDs`,
|
description: `Shuffle the token IDs`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'update_discount_price',
|
||||||
|
name: 'Update Discount Price',
|
||||||
|
description: `Updates discount price`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'remove_discount_price',
|
||||||
|
name: 'Remove Discount Price',
|
||||||
|
description: `Removes discount price`,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface DispatchExecuteProps {
|
export interface DispatchExecuteProps {
|
||||||
@ -80,6 +92,8 @@ export type DispatchExecuteArgs = {
|
|||||||
| { type: Select<'mint_for'>; recipient: string; tokenId: number }
|
| { type: Select<'mint_for'>; recipient: string; tokenId: number }
|
||||||
| { type: Select<'shuffle'> }
|
| { type: Select<'shuffle'> }
|
||||||
| { type: Select<'withdraw'> }
|
| { type: Select<'withdraw'> }
|
||||||
|
| { type: Select<'update_discount_price'>; price: string }
|
||||||
|
| { type: Select<'remove_discount_price'> }
|
||||||
)
|
)
|
||||||
|
|
||||||
export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
||||||
@ -112,6 +126,12 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => {
|
|||||||
case 'withdraw': {
|
case 'withdraw': {
|
||||||
return messages.withdraw(txSigner)
|
return messages.withdraw(txSigner)
|
||||||
}
|
}
|
||||||
|
case 'update_discount_price': {
|
||||||
|
return messages.updateDiscountPrice(txSigner, args.price === '' ? '0' : args.price)
|
||||||
|
}
|
||||||
|
case 'remove_discount_price': {
|
||||||
|
return messages.removeDiscountPrice(txSigner)
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error('unknown execute type')
|
throw new Error('unknown execute type')
|
||||||
}
|
}
|
||||||
@ -147,6 +167,12 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
|
|||||||
case 'withdraw': {
|
case 'withdraw': {
|
||||||
return messages(contract)?.withdraw()
|
return messages(contract)?.withdraw()
|
||||||
}
|
}
|
||||||
|
case 'update_discount_price': {
|
||||||
|
return messages(contract)?.updateDiscountPrice(args.price === '' ? '0' : args.price)
|
||||||
|
}
|
||||||
|
case 'remove_discount_price': {
|
||||||
|
return messages(contract)?.removeDiscountPrice()
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import type { logs } from '@cosmjs/stargate'
|
|||||||
import { useWallet } from 'contexts/wallet'
|
import { useWallet } from 'contexts/wallet'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import type { MinterContract, MinterInstance, MinterMessages } from './contract'
|
import type { MigrateResponse, MinterContract, MinterInstance, MinterMessages } from './contract'
|
||||||
import { minter as initContract } from './contract'
|
import { minter as initContract } from './contract'
|
||||||
|
|
||||||
/*export interface InstantiateResponse {
|
/*export interface InstantiateResponse {
|
||||||
@ -32,6 +32,7 @@ export interface UseMinterContractProps {
|
|||||||
admin?: string,
|
admin?: string,
|
||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<InstantiateResponse>
|
) => Promise<InstantiateResponse>
|
||||||
|
migrate: (contractAddress: string, codeId: number, migrateMsg: Record<string, unknown>) => Promise<MigrateResponse>
|
||||||
use: (customAddress: string) => MinterInstance | undefined
|
use: (customAddress: string) => MinterInstance | undefined
|
||||||
updateContractAddress: (contractAddress: string) => void
|
updateContractAddress: (contractAddress: string) => void
|
||||||
getContractAddress: () => string | undefined
|
getContractAddress: () => string | undefined
|
||||||
@ -70,6 +71,20 @@ export function useMinterContract(): UseMinterContractProps {
|
|||||||
[minter, wallet],
|
[minter, wallet],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const migrate = useCallback(
|
||||||
|
(contractAddress: string, codeId: number, migrateMsg: Record<string, unknown>): Promise<MigrateResponse> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!minter) {
|
||||||
|
reject(new Error('Contract is not initialized.'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(wallet.address, contractAddress, codeId)
|
||||||
|
minter.migrate(wallet.address, contractAddress, codeId, migrateMsg).then(resolve).catch(reject)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
[minter, wallet],
|
||||||
|
)
|
||||||
|
|
||||||
const use = useCallback(
|
const use = useCallback(
|
||||||
(customAddress = ''): MinterInstance | undefined => {
|
(customAddress = ''): MinterInstance | undefined => {
|
||||||
return minter?.use(address || customAddress)
|
return minter?.use(address || customAddress)
|
||||||
@ -94,5 +109,6 @@ export function useMinterContract(): UseMinterContractProps {
|
|||||||
updateContractAddress,
|
updateContractAddress,
|
||||||
getContractAddress,
|
getContractAddress,
|
||||||
messages,
|
messages,
|
||||||
|
migrate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { MsgExecuteContractEncodeObject, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
import type { MsgExecuteContractEncodeObject, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { toBase64, toUtf8 } from '@cosmjs/encoding'
|
import { toBase64, toUtf8 } from '@cosmjs/encoding'
|
||||||
import type { Coin } from '@cosmjs/stargate'
|
import type { Coin, logs } from '@cosmjs/stargate'
|
||||||
import { coin } from '@cosmjs/stargate'
|
import { coin } from '@cosmjs/stargate'
|
||||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
|
||||||
@ -9,6 +9,16 @@ export interface InstantiateResponse {
|
|||||||
readonly transactionHash: string
|
readonly transactionHash: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MigrateResponse {
|
||||||
|
readonly transactionHash: string
|
||||||
|
readonly logs: readonly logs.Log[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RoyaltyInfo {
|
||||||
|
payment_address: string
|
||||||
|
share_bps: number
|
||||||
|
}
|
||||||
|
|
||||||
export type Expiration = { at_height: number } | { at_time: string } | { never: Record<string, never> }
|
export type Expiration = { at_height: number } | { at_time: string } | { never: Record<string, never> }
|
||||||
|
|
||||||
export interface SG721Instance {
|
export interface SG721Instance {
|
||||||
@ -65,11 +75,15 @@ export interface SG721Instance {
|
|||||||
revokeAll: (operator: string) => Promise<string>
|
revokeAll: (operator: string) => Promise<string>
|
||||||
/// Mint a new NFT, can only be called by the contract minter
|
/// Mint a new NFT, can only be called by the contract minter
|
||||||
mint: (tokenId: string, owner: string, tokenURI?: string) => Promise<string> //MintMsg<T>
|
mint: (tokenId: string, owner: string, tokenURI?: string) => Promise<string> //MintMsg<T>
|
||||||
|
updateRoyaltyInfo: (royaltyInfo: RoyaltyInfo) => Promise<string>
|
||||||
|
|
||||||
/// Burn an NFT the sender has access to
|
/// Burn an NFT the sender has access to
|
||||||
burn: (tokenId: string) => Promise<string>
|
burn: (tokenId: string) => Promise<string>
|
||||||
batchBurn: (tokenIds: string) => Promise<string>
|
batchBurn: (tokenIds: string) => Promise<string>
|
||||||
batchTransfer: (recipient: string, tokenIds: string) => Promise<string>
|
batchTransfer: (recipient: string, tokenIds: string) => Promise<string>
|
||||||
|
updateTokenMetadata: (tokenId: string, tokenURI?: string) => Promise<string>
|
||||||
|
batchUpdateTokenMetadata: (tokenIds: string, tokenURI?: string) => Promise<string>
|
||||||
|
freezeTokenMetadata: () => Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Sg721Messages {
|
export interface Sg721Messages {
|
||||||
@ -80,9 +94,51 @@ export interface Sg721Messages {
|
|||||||
approveAll: (operator: string, expires?: Expiration) => ApproveAllMessage
|
approveAll: (operator: string, expires?: Expiration) => ApproveAllMessage
|
||||||
revokeAll: (operator: string) => RevokeAllMessage
|
revokeAll: (operator: string) => RevokeAllMessage
|
||||||
mint: (tokenId: string, owner: string, tokenURI?: string) => MintMessage
|
mint: (tokenId: string, owner: string, tokenURI?: string) => MintMessage
|
||||||
|
updateRoyaltyInfo: (royaltyInfo: RoyaltyInfo) => UpdateRoyaltyInfoMessage
|
||||||
burn: (tokenId: string) => BurnMessage
|
burn: (tokenId: string) => BurnMessage
|
||||||
batchBurn: (tokenIds: string) => BatchBurnMessage
|
batchBurn: (tokenIds: string) => BatchBurnMessage
|
||||||
batchTransfer: (recipient: string, tokenIds: string) => BatchTransferMessage
|
batchTransfer: (recipient: string, tokenIds: string) => BatchTransferMessage
|
||||||
|
updateTokenMetadata: (tokenId: string, tokenURI?: string) => UpdateTokenMetadataMessage
|
||||||
|
batchUpdateTokenMetadata: (tokenIds: string, tokenURI?: string) => BatchUpdateTokenMetadataMessage
|
||||||
|
freezeTokenMetadata: () => FreezeTokenMetadataMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateRoyaltyInfoMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: {
|
||||||
|
update_royalty_info: {
|
||||||
|
payment_address: string
|
||||||
|
share_bps: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
funds: Coin[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateTokenMetadataMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: {
|
||||||
|
update_token_metadata: {
|
||||||
|
token_id: string
|
||||||
|
token_uri: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
funds: Coin[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BatchUpdateTokenMetadataMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: Record<string, unknown>[]
|
||||||
|
funds: Coin[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FreezeTokenMetadataMessage {
|
||||||
|
sender: string
|
||||||
|
contract: string
|
||||||
|
msg: { freeze_token_metadata: Record<string, never> }
|
||||||
|
funds: Coin[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransferNFTMessage {
|
export interface TransferNFTMessage {
|
||||||
@ -206,6 +262,13 @@ export interface SG721Contract {
|
|||||||
admin?: string,
|
admin?: string,
|
||||||
) => Promise<InstantiateResponse>
|
) => Promise<InstantiateResponse>
|
||||||
|
|
||||||
|
migrate: (
|
||||||
|
senderAddress: string,
|
||||||
|
contractAddress: string,
|
||||||
|
codeId: number,
|
||||||
|
migrateMsg: Record<string, unknown>,
|
||||||
|
) => Promise<MigrateResponse>
|
||||||
|
|
||||||
use: (contractAddress: string) => SG721Instance
|
use: (contractAddress: string) => SG721Instance
|
||||||
|
|
||||||
messages: (contractAddress: string) => Sg721Messages
|
messages: (contractAddress: string) => Sg721Messages
|
||||||
@ -413,6 +476,22 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
return res.transactionHash
|
return res.transactionHash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateRoyaltyInfo = async (royaltyInfo: RoyaltyInfo): Promise<string> => {
|
||||||
|
const res = await client.execute(
|
||||||
|
txSigner,
|
||||||
|
contractAddress,
|
||||||
|
{
|
||||||
|
update_royalty_info: {
|
||||||
|
payment_address: royaltyInfo.payment_address,
|
||||||
|
share_bps: royaltyInfo.share_bps * 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'auto',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
|
|
||||||
const burn = async (tokenId: string): Promise<string> => {
|
const burn = async (tokenId: string): Promise<string> => {
|
||||||
const res = await client.execute(
|
const res = await client.execute(
|
||||||
txSigner,
|
txSigner,
|
||||||
@ -513,6 +592,81 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
return res.transactionHash
|
return res.transactionHash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const batchUpdateTokenMetadata = async (tokenIds: string, baseURI?: string): Promise<string> => {
|
||||||
|
const executeContractMsgs: MsgExecuteContractEncodeObject[] = []
|
||||||
|
if (tokenIds.includes(':')) {
|
||||||
|
const [start, end] = tokenIds.split(':').map(Number)
|
||||||
|
for (let i = start; i <= end; i++) {
|
||||||
|
const msg = {
|
||||||
|
update_token_metadata: { token_id: i.toString(), token_uri: baseURI ? `${baseURI}/${i}` : undefined },
|
||||||
|
}
|
||||||
|
const executeContractMsg: MsgExecuteContractEncodeObject = {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: toUtf8(JSON.stringify(msg)),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
executeContractMsgs.push(executeContractMsg)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const tokenNumbers = tokenIds.split(',').map(Number)
|
||||||
|
for (let i = 0; i < tokenNumbers.length; i++) {
|
||||||
|
const msg = {
|
||||||
|
update_token_metadata: {
|
||||||
|
token_id: tokenNumbers[i].toString(),
|
||||||
|
token_uri: baseURI ? `${baseURI}/${tokenNumbers[i]}` : undefined,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const executeContractMsg: MsgExecuteContractEncodeObject = {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: toUtf8(JSON.stringify(msg)),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
executeContractMsgs.push(executeContractMsg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await client.signAndBroadcast(txSigner, executeContractMsgs, 'auto', 'batch update metadata')
|
||||||
|
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTokenMetadata = async (tokenId: string, tokenURI?: string): Promise<string> => {
|
||||||
|
const res = await client.execute(
|
||||||
|
txSigner,
|
||||||
|
contractAddress,
|
||||||
|
{
|
||||||
|
update_token_metadata: {
|
||||||
|
token_id: tokenId,
|
||||||
|
token_uri: tokenURI ? tokenURI : undefined,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'auto',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
|
|
||||||
|
const freezeTokenMetadata = async (): Promise<string> => {
|
||||||
|
const res = await client.execute(
|
||||||
|
txSigner,
|
||||||
|
contractAddress,
|
||||||
|
{
|
||||||
|
freeze_token_metadata: {},
|
||||||
|
},
|
||||||
|
'auto',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
return res.transactionHash
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
contractAddress,
|
contractAddress,
|
||||||
ownerOf,
|
ownerOf,
|
||||||
@ -521,6 +675,9 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
allOperators,
|
allOperators,
|
||||||
numTokens,
|
numTokens,
|
||||||
contractInfo,
|
contractInfo,
|
||||||
|
updateTokenMetadata,
|
||||||
|
freezeTokenMetadata,
|
||||||
|
batchUpdateTokenMetadata,
|
||||||
nftInfo,
|
nftInfo,
|
||||||
allNftInfo,
|
allNftInfo,
|
||||||
tokens,
|
tokens,
|
||||||
@ -534,12 +691,26 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
approveAll,
|
approveAll,
|
||||||
revokeAll,
|
revokeAll,
|
||||||
mint,
|
mint,
|
||||||
|
updateRoyaltyInfo,
|
||||||
burn,
|
burn,
|
||||||
batchBurn,
|
batchBurn,
|
||||||
batchTransfer,
|
batchTransfer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const migrate = async (
|
||||||
|
senderAddress: string,
|
||||||
|
contractAddress: string,
|
||||||
|
codeId: number,
|
||||||
|
migrateMsg: Record<string, unknown>,
|
||||||
|
): Promise<MigrateResponse> => {
|
||||||
|
const result = await client.migrate(senderAddress, contractAddress, codeId, migrateMsg, 'auto')
|
||||||
|
return {
|
||||||
|
transactionHash: result.transactionHash,
|
||||||
|
logs: result.logs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const instantiate = async (
|
const instantiate = async (
|
||||||
senderAddress: string,
|
senderAddress: string,
|
||||||
codeId: number,
|
codeId: number,
|
||||||
@ -659,6 +830,20 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateRoyaltyInfo = (royaltyInfo: RoyaltyInfo) => {
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: {
|
||||||
|
update_royalty_info: {
|
||||||
|
payment_address: royaltyInfo.payment_address,
|
||||||
|
share_bps: royaltyInfo.share_bps * 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const burn = (tokenId: string) => {
|
const burn = (tokenId: string) => {
|
||||||
return {
|
return {
|
||||||
sender: txSigner,
|
sender: txSigner,
|
||||||
@ -720,6 +905,60 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const batchUpdateTokenMetadata = (tokenIds: string, baseURI?: string): BatchUpdateTokenMetadataMessage => {
|
||||||
|
const msg: Record<string, unknown>[] = []
|
||||||
|
if (tokenIds.includes(':')) {
|
||||||
|
const [start, end] = tokenIds.split(':').map(Number)
|
||||||
|
for (let i = start; i <= end; i++) {
|
||||||
|
msg.push({
|
||||||
|
update_token_metadata: { token_id: i.toString(), token_uri: baseURI ? `${baseURI}/${i}` : '' },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const tokenNumbers = tokenIds.split(',').map(Number)
|
||||||
|
for (let i = 0; i < tokenNumbers.length; i++) {
|
||||||
|
msg.push({
|
||||||
|
update_token_metadata: {
|
||||||
|
token_id: tokenNumbers[i].toString(),
|
||||||
|
token_uri: baseURI ? `${baseURI}/${tokenNumbers[i]}` : '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg,
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTokenMetadata = (tokenId: string, tokenURI?: string) => {
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: {
|
||||||
|
update_token_metadata: {
|
||||||
|
token_id: tokenId,
|
||||||
|
token_uri: tokenURI ? tokenURI : '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const freezeTokenMetadata = () => {
|
||||||
|
return {
|
||||||
|
sender: txSigner,
|
||||||
|
contract: contractAddress,
|
||||||
|
msg: {
|
||||||
|
freeze_token_metadata: {},
|
||||||
|
},
|
||||||
|
funds: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
transferNft,
|
transferNft,
|
||||||
sendNft,
|
sendNft,
|
||||||
@ -728,11 +967,15 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con
|
|||||||
approveAll,
|
approveAll,
|
||||||
revokeAll,
|
revokeAll,
|
||||||
mint,
|
mint,
|
||||||
|
updateRoyaltyInfo,
|
||||||
burn,
|
burn,
|
||||||
batchBurn,
|
batchBurn,
|
||||||
batchTransfer,
|
batchTransfer,
|
||||||
|
batchUpdateTokenMetadata,
|
||||||
|
updateTokenMetadata,
|
||||||
|
freezeTokenMetadata,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { use, instantiate, messages }
|
return { use, instantiate, migrate, messages }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import type { Coin } from '@cosmjs/proto-signing'
|
|||||||
import { useWallet } from 'contexts/wallet'
|
import { useWallet } from 'contexts/wallet'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import type { SG721Contract, SG721Instance, Sg721Messages } from './contract'
|
import type { MigrateResponse, SG721Contract, SG721Instance, Sg721Messages } from './contract'
|
||||||
import { SG721 as initContract } from './contract'
|
import { SG721 as initContract } from './contract'
|
||||||
|
|
||||||
interface InstantiateResponse {
|
interface InstantiateResponse {
|
||||||
@ -18,6 +18,7 @@ export interface UseSG721ContractProps {
|
|||||||
admin?: string,
|
admin?: string,
|
||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<InstantiateResponse>
|
) => Promise<InstantiateResponse>
|
||||||
|
migrate: (contractAddress: string, codeId: number, migrateMsg: Record<string, unknown>) => Promise<MigrateResponse>
|
||||||
use: (customAddress: string) => SG721Instance | undefined
|
use: (customAddress: string) => SG721Instance | undefined
|
||||||
updateContractAddress: (contractAddress: string) => void
|
updateContractAddress: (contractAddress: string) => void
|
||||||
messages: (contractAddress: string) => Sg721Messages | undefined
|
messages: (contractAddress: string) => Sg721Messages | undefined
|
||||||
@ -55,6 +56,19 @@ export function useSG721Contract(): UseSG721ContractProps {
|
|||||||
[SG721, wallet],
|
[SG721, wallet],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const migrate = useCallback(
|
||||||
|
(contractAddress: string, codeId: number, migrateMsg: Record<string, unknown>): Promise<MigrateResponse> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!SG721) {
|
||||||
|
reject(new Error('Contract is not initialized.'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
SG721.migrate(wallet.address, contractAddress, codeId, migrateMsg).then(resolve).catch(reject)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
[SG721, wallet],
|
||||||
|
)
|
||||||
|
|
||||||
const use = useCallback(
|
const use = useCallback(
|
||||||
(customAddress = ''): SG721Instance | undefined => {
|
(customAddress = ''): SG721Instance | undefined => {
|
||||||
return SG721?.use(address || customAddress)
|
return SG721?.use(address || customAddress)
|
||||||
@ -74,5 +88,6 @@ export function useSG721Contract(): UseSG721ContractProps {
|
|||||||
use,
|
use,
|
||||||
updateContractAddress,
|
updateContractAddress,
|
||||||
messages,
|
messages,
|
||||||
|
migrate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
env.d.ts
vendored
1
env.d.ts
vendored
@ -17,6 +17,7 @@ declare namespace NodeJS {
|
|||||||
readonly NEXT_PUBLIC_SG721_CODE_ID: string
|
readonly NEXT_PUBLIC_SG721_CODE_ID: string
|
||||||
readonly NEXT_PUBLIC_MINTER_CODE_ID: string
|
readonly NEXT_PUBLIC_MINTER_CODE_ID: string
|
||||||
readonly NEXT_PUBLIC_WHITELIST_CODE_ID: string
|
readonly NEXT_PUBLIC_WHITELIST_CODE_ID: string
|
||||||
|
readonly NEXT_PUBLIC_SG721_UPDATABLE_V1_CODE_ID: string
|
||||||
|
|
||||||
readonly NEXT_PUBLIC_PINATA_ENDPOINT_URL: string
|
readonly NEXT_PUBLIC_PINATA_ENDPOINT_URL: string
|
||||||
readonly NEXT_PUBLIC_API_URL: string
|
readonly NEXT_PUBLIC_API_URL: string
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stargaze-studio",
|
"name": "stargaze-studio",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
|
|||||||
@ -84,7 +84,7 @@ const MinterExecutePage: NextPage = () => {
|
|||||||
const showLimitField = type === 'update_per_address_limit'
|
const showLimitField = type === 'update_per_address_limit'
|
||||||
const showTokenIdField = type === 'mint_for'
|
const showTokenIdField = type === 'mint_for'
|
||||||
const showRecipientField = isEitherType(type, ['mint_to', 'mint_for'])
|
const showRecipientField = isEitherType(type, ['mint_to', 'mint_for'])
|
||||||
const showPriceField = type === 'mint'
|
const showPriceField = isEitherType(type, ['mint', 'update_discount_price'])
|
||||||
|
|
||||||
const messages = useMemo(() => contract?.use(contractState.value), [contract, wallet.address, contractState.value])
|
const messages = useMemo(() => contract?.use(contractState.value), [contract, wallet.address, contractState.value])
|
||||||
const payload: DispatchExecuteArgs = {
|
const payload: DispatchExecuteArgs = {
|
||||||
|
|||||||
132
pages/contracts/minter/migrate.tsx
Normal file
132
pages/contracts/minter/migrate.tsx
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
import { Button } from 'components/Button'
|
||||||
|
import { ContractPageHeader } from 'components/ContractPageHeader'
|
||||||
|
import { useExecuteComboboxState } from 'components/contracts/minter/ExecuteCombobox.hooks'
|
||||||
|
import { FormControl } from 'components/FormControl'
|
||||||
|
import { AddressInput, NumberInput } from 'components/forms/FormInput'
|
||||||
|
import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
|
||||||
|
import { JsonPreview } from 'components/JsonPreview'
|
||||||
|
import { LinkTabs } from 'components/LinkTabs'
|
||||||
|
import { minterLinkTabs } from 'components/LinkTabs.data'
|
||||||
|
import { TransactionHash } from 'components/TransactionHash'
|
||||||
|
import { useContracts } from 'contexts/contracts'
|
||||||
|
import { useWallet } from 'contexts/wallet'
|
||||||
|
import type { MigrateResponse } from 'contracts/minter'
|
||||||
|
import type { NextPage } from 'next'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
import { NextSeo } from 'next-seo'
|
||||||
|
import type { FormEvent } from 'react'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { toast } from 'react-hot-toast'
|
||||||
|
import { FaArrowRight } from 'react-icons/fa'
|
||||||
|
import { useMutation } from 'react-query'
|
||||||
|
import { withMetadata } from 'utils/layout'
|
||||||
|
import { links } from 'utils/links'
|
||||||
|
|
||||||
|
const MinterMigratePage: NextPage = () => {
|
||||||
|
const { minter: contract } = useContracts()
|
||||||
|
const wallet = useWallet()
|
||||||
|
|
||||||
|
const [lastTx, setLastTx] = useState('')
|
||||||
|
|
||||||
|
const comboboxState = useExecuteComboboxState()
|
||||||
|
const type = comboboxState.value?.id
|
||||||
|
const codeIdState = useNumberInputState({
|
||||||
|
id: 'code-id',
|
||||||
|
name: 'code-id',
|
||||||
|
title: 'Code ID',
|
||||||
|
subtitle: 'Code ID of the New Minter',
|
||||||
|
placeholder: '1',
|
||||||
|
})
|
||||||
|
|
||||||
|
const contractState = useInputState({
|
||||||
|
id: 'contract-address',
|
||||||
|
name: 'contract-address',
|
||||||
|
title: 'Minter Address',
|
||||||
|
subtitle: 'Address of the Minter contract',
|
||||||
|
})
|
||||||
|
const contractAddress = contractState.value
|
||||||
|
|
||||||
|
const { data, isLoading, mutate } = useMutation(
|
||||||
|
async (event: FormEvent): Promise<MigrateResponse | null> => {
|
||||||
|
event.preventDefault()
|
||||||
|
if (!contract) {
|
||||||
|
throw new Error('Smart contract connection failed')
|
||||||
|
}
|
||||||
|
if (!wallet.initialized) {
|
||||||
|
throw new Error('Please connect your wallet.')
|
||||||
|
}
|
||||||
|
|
||||||
|
const migrateMsg = {}
|
||||||
|
return toast.promise(contract.migrate(contractAddress, codeIdState.value, migrateMsg), {
|
||||||
|
error: `Migration failed!`,
|
||||||
|
loading: 'Executing message...',
|
||||||
|
success: (tx) => {
|
||||||
|
if (tx) {
|
||||||
|
setLastTx(tx.transactionHash)
|
||||||
|
}
|
||||||
|
return `Transaction success!`
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onError: (error) => {
|
||||||
|
toast.error(String(error))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (contractAddress.length > 0) {
|
||||||
|
void router.replace({ query: { contractAddress } })
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [contractAddress])
|
||||||
|
useEffect(() => {
|
||||||
|
const initial = new URL(document.URL).searchParams.get('contractAddress')
|
||||||
|
if (initial && initial.length > 0) contractState.onChange(initial)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="py-6 px-12 space-y-4">
|
||||||
|
<NextSeo title="Execute Minter Contract" />
|
||||||
|
<ContractPageHeader
|
||||||
|
description="Minter contract facilitates primary market vending machine style minting."
|
||||||
|
link={links.Documentation}
|
||||||
|
title="Minter Contract"
|
||||||
|
/>
|
||||||
|
<LinkTabs activeIndex={3} data={minterLinkTabs} />
|
||||||
|
|
||||||
|
<form className="grid grid-cols-2 p-4 space-x-8" onSubmit={mutate}>
|
||||||
|
<div className="space-y-8">
|
||||||
|
<AddressInput {...contractState} />
|
||||||
|
<NumberInput isRequired {...codeIdState} />
|
||||||
|
</div>
|
||||||
|
<div className="space-y-8">
|
||||||
|
<div className="relative">
|
||||||
|
<Button className="absolute top-0 right-0" isLoading={isLoading} rightIcon={<FaArrowRight />} type="submit">
|
||||||
|
Execute
|
||||||
|
</Button>
|
||||||
|
<FormControl subtitle="View execution transaction hash" title="Transaction Hash">
|
||||||
|
<TransactionHash hash={lastTx} />
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
|
<FormControl subtitle="View current message to be sent" title="Payload Preview">
|
||||||
|
<JsonPreview
|
||||||
|
content={{
|
||||||
|
sender: wallet.address,
|
||||||
|
contract: contractAddress,
|
||||||
|
code_id: codeIdState.value,
|
||||||
|
msg: {},
|
||||||
|
}}
|
||||||
|
isCopyable
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withMetadata(MinterMigratePage, { center: false })
|
||||||
154
pages/contracts/sg721/migrate.tsx
Normal file
154
pages/contracts/sg721/migrate.tsx
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
import { Alert } from 'components/Alert'
|
||||||
|
import { Anchor } from 'components/Anchor'
|
||||||
|
import { Button } from 'components/Button'
|
||||||
|
import { Conditional } from 'components/Conditional'
|
||||||
|
import { ContractPageHeader } from 'components/ContractPageHeader'
|
||||||
|
import { useExecuteComboboxState } from 'components/contracts/sg721/ExecuteCombobox.hooks'
|
||||||
|
import { FormControl } from 'components/FormControl'
|
||||||
|
import { AddressInput, NumberInput } from 'components/forms/FormInput'
|
||||||
|
import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
|
||||||
|
import { JsonPreview } from 'components/JsonPreview'
|
||||||
|
import { LinkTabs } from 'components/LinkTabs'
|
||||||
|
import { sg721LinkTabs } from 'components/LinkTabs.data'
|
||||||
|
import { TransactionHash } from 'components/TransactionHash'
|
||||||
|
import { useContracts } from 'contexts/contracts'
|
||||||
|
import { useWallet } from 'contexts/wallet'
|
||||||
|
import type { MigrateResponse } from 'contracts/sg721'
|
||||||
|
import type { NextPage } from 'next'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
import { NextSeo } from 'next-seo'
|
||||||
|
import type { FormEvent } from 'react'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { toast } from 'react-hot-toast'
|
||||||
|
import { FaArrowRight } from 'react-icons/fa'
|
||||||
|
import { useMutation } from 'react-query'
|
||||||
|
import { SG721_UPDATABLE_V1_CODE_ID } from 'utils/constants'
|
||||||
|
import { withMetadata } from 'utils/layout'
|
||||||
|
import { links } from 'utils/links'
|
||||||
|
|
||||||
|
const Sg721MigratePage: NextPage = () => {
|
||||||
|
const { sg721: contract } = useContracts()
|
||||||
|
const wallet = useWallet()
|
||||||
|
|
||||||
|
const [lastTx, setLastTx] = useState('')
|
||||||
|
|
||||||
|
const comboboxState = useExecuteComboboxState()
|
||||||
|
const type = comboboxState.value?.id
|
||||||
|
const codeIdState = useNumberInputState({
|
||||||
|
id: 'code-id',
|
||||||
|
name: 'code-id',
|
||||||
|
title: 'Code ID',
|
||||||
|
subtitle: 'Code ID of the New Sg721 contract',
|
||||||
|
placeholder: '1',
|
||||||
|
defaultValue: SG721_UPDATABLE_V1_CODE_ID,
|
||||||
|
})
|
||||||
|
|
||||||
|
const contractState = useInputState({
|
||||||
|
id: 'contract-address',
|
||||||
|
name: 'contract-address',
|
||||||
|
title: 'Sg721 Address',
|
||||||
|
subtitle: 'Address of the Sg721 contract',
|
||||||
|
})
|
||||||
|
const contractAddress = contractState.value
|
||||||
|
|
||||||
|
const { data, isLoading, mutate } = useMutation(
|
||||||
|
async (event: FormEvent): Promise<MigrateResponse | null> => {
|
||||||
|
event.preventDefault()
|
||||||
|
if (!contract) {
|
||||||
|
throw new Error('Smart contract connection failed')
|
||||||
|
}
|
||||||
|
if (!wallet.initialized) {
|
||||||
|
throw new Error('Please connect your wallet.')
|
||||||
|
}
|
||||||
|
|
||||||
|
const migrateMsg = {}
|
||||||
|
return toast.promise(contract.migrate(contractAddress, codeIdState.value, migrateMsg), {
|
||||||
|
error: `Migration failed!`,
|
||||||
|
loading: 'Executing message...',
|
||||||
|
success: (tx) => {
|
||||||
|
if (tx) {
|
||||||
|
setLastTx(tx.transactionHash)
|
||||||
|
}
|
||||||
|
return `Transaction success!`
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onError: (error) => {
|
||||||
|
toast.error(String(error), { style: { maxWidth: 'none' } })
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (contractAddress.length > 0) {
|
||||||
|
void router.replace({ query: { contractAddress } })
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [contractAddress])
|
||||||
|
useEffect(() => {
|
||||||
|
const initial = new URL(document.URL).searchParams.get('contractAddress')
|
||||||
|
if (initial && initial.length > 0) contractState.onChange(initial)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="py-6 px-12 space-y-4">
|
||||||
|
<NextSeo title="Migrate Sg721 Contract" />
|
||||||
|
<ContractPageHeader
|
||||||
|
description="Sg721 contract is a wrapper contract that has a set of optional extensions on top of cw721-base."
|
||||||
|
link={links.Documentation}
|
||||||
|
title="Sg721 Contract"
|
||||||
|
/>
|
||||||
|
<LinkTabs activeIndex={3} data={sg721LinkTabs} />
|
||||||
|
|
||||||
|
<form className="grid grid-cols-2 p-4 space-x-8" onSubmit={mutate}>
|
||||||
|
<div className="space-y-8">
|
||||||
|
<AddressInput {...contractState} />
|
||||||
|
<NumberInput isRequired {...codeIdState} />
|
||||||
|
<Conditional test={SG721_UPDATABLE_V1_CODE_ID > 0}>
|
||||||
|
<Alert type="info">
|
||||||
|
<div className="inline-block">
|
||||||
|
Migrating a v1 contract to Code ID: {SG721_UPDATABLE_V1_CODE_ID} (sg721-updatable) will allow the
|
||||||
|
creator to update the royalty details and token metadata. Once the migration is complete, new
|
||||||
|
functionalities can be performed using{' '}
|
||||||
|
<Anchor
|
||||||
|
className="font-bold text-plumbus hover:underline"
|
||||||
|
external
|
||||||
|
href={`/collections/actions/?sg721ContractAddress=${contractState.value}`}
|
||||||
|
>
|
||||||
|
Collection Actions
|
||||||
|
</Anchor>
|
||||||
|
.
|
||||||
|
</div>
|
||||||
|
</Alert>
|
||||||
|
</Conditional>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-8">
|
||||||
|
<div className="relative">
|
||||||
|
<Button className="absolute top-0 right-0" isLoading={isLoading} rightIcon={<FaArrowRight />} type="submit">
|
||||||
|
Execute
|
||||||
|
</Button>
|
||||||
|
<FormControl subtitle="View execution transaction hash" title="Transaction Hash">
|
||||||
|
<TransactionHash hash={lastTx} />
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
|
<FormControl subtitle="View current message to be sent" title="Payload Preview">
|
||||||
|
<JsonPreview
|
||||||
|
content={{
|
||||||
|
sender: wallet.address,
|
||||||
|
contract: contractAddress,
|
||||||
|
code_id: codeIdState.value,
|
||||||
|
msg: {},
|
||||||
|
}}
|
||||||
|
isCopyable
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withMetadata(Sg721MigratePage, { center: false })
|
||||||
@ -1,6 +1,7 @@
|
|||||||
export const SG721_CODE_ID = parseInt(process.env.NEXT_PUBLIC_SG721_CODE_ID, 10)
|
export const SG721_CODE_ID = parseInt(process.env.NEXT_PUBLIC_SG721_CODE_ID, 10)
|
||||||
export const MINTER_CODE_ID = parseInt(process.env.NEXT_PUBLIC_MINTER_CODE_ID, 10)
|
export const MINTER_CODE_ID = parseInt(process.env.NEXT_PUBLIC_MINTER_CODE_ID, 10)
|
||||||
export const WHITELIST_CODE_ID = parseInt(process.env.NEXT_PUBLIC_WHITELIST_CODE_ID, 10)
|
export const WHITELIST_CODE_ID = parseInt(process.env.NEXT_PUBLIC_WHITELIST_CODE_ID, 10)
|
||||||
|
export const SG721_UPDATABLE_V1_CODE_ID = parseInt(process.env.NEXT_PUBLIC_SG721_UPDATABLE_V1_CODE_ID, 10)
|
||||||
|
|
||||||
export const PINATA_ENDPOINT_URL = process.env.NEXT_PUBLIC_PINATA_ENDPOINT_URL
|
export const PINATA_ENDPOINT_URL = process.env.NEXT_PUBLIC_PINATA_ENDPOINT_URL
|
||||||
export const NETWORK = process.env.NEXT_PUBLIC_NETWORK
|
export const NETWORK = process.env.NEXT_PUBLIC_NETWORK
|
||||||
|
|||||||
@ -3557,9 +3557,9 @@ camelcase@^6.2.0:
|
|||||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||||
|
|
||||||
caniuse-lite@^1.0.30001283, caniuse-lite@^1.0.30001332:
|
caniuse-lite@^1.0.30001283, caniuse-lite@^1.0.30001332:
|
||||||
version "1.0.30001332"
|
version "1.0.30001434"
|
||||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001332.tgz"
|
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz"
|
||||||
integrity sha512-10T30NYOEQtN6C11YGg411yebhvpnC6Z102+B95eAsN0oB6KUs01ivE8u+G6FMIRtIrVlYXhL+LUwQ3/hXwDWw==
|
integrity sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==
|
||||||
|
|
||||||
carbites@^1.0.6:
|
carbites@^1.0.6:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user