Skip to content

Commit

Permalink
Merge pull request #279 from public-awesome/fetch-creation-fees
Browse files Browse the repository at this point in the history
Fetch collection creation fees from factory parameters
shanev authored Jul 6, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents f5d458b + 16b3c1a commit c1160a1
Showing 3 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/create-collection/base-minter.ts
Original file line number Diff line number Diff line change
@@ -11,8 +11,6 @@ import {

const config = require('../../config');

const NEW_COLLECTION_FEE = coins('250000000', 'ustars');

function clean(obj: any) {
return JSON.parse(JSON.stringify(obj));
}
@@ -70,6 +68,8 @@ export async function create_minter() {

const tempMsg = { create_minter: initMsg };

const creationFee = paramsResponse.params.creation_fee.amount;

if (
tempMsg.create_minter?.collection_params.info?.royalty_info
?.payment_address === undefined &&
@@ -87,9 +87,9 @@ export async function create_minter() {
console.log(JSON.stringify(msg, null, 2));
console.log(
'Cost of minter instantiation: ' +
NEW_COLLECTION_FEE[0].amount +
creationFee +
' ' +
NEW_COLLECTION_FEE[0].denom
'ustars'
);
const answer = await inquirer.prompt([
{
@@ -106,7 +106,7 @@ export async function create_minter() {
msg,
'auto',
config.name,
NEW_COLLECTION_FEE
coins(creationFee, 'ustars')
);
const wasmEvent = result.logs[0].events.find((e) => e.type === 'wasm');
console.info(
10 changes: 6 additions & 4 deletions src/create-collection/minter.ts
Original file line number Diff line number Diff line change
@@ -143,6 +143,8 @@ export async function create_minter(params: MinterParams) {
);
console.log('params response', paramsResponse);

const creationFee = paramsResponse.params.creation_fee.amount;

const tempMsg = { create_minter: initMsg };

// TODO use recursive cleanup of undefined and null values
@@ -165,7 +167,7 @@ export async function create_minter(params: MinterParams) {
msg: toUtf8(
JSON.stringify(obj)
),
funds:NEW_COLLECTION_FEE,
funds: coins(creationFee, 'ustars'),
},
};

@@ -180,9 +182,9 @@ export async function create_minter(params: MinterParams) {
console.log(JSON.stringify(msg, null, 2));
console.log(
'Cost of minter instantiation: ' +
NEW_COLLECTION_FEE[0].amount +
creationFee +
' ' +
NEW_COLLECTION_FEE[0].denom
'ustars'
);
console.log("Total gas fee to be paid",await client.simulate(account, [encodeMsg],undefined)+" ustars");
const answer = await inquirer.prompt([
@@ -200,7 +202,7 @@ export async function create_minter(params: MinterParams) {
msg,
'auto',
config.name,
NEW_COLLECTION_FEE
coins(creationFee, 'ustars')
);
const wasmEvent = result.logs[0].events.find((e) => e.type === 'wasm');
console.info(
12 changes: 6 additions & 6 deletions src/create-collection/open-edition-minter.ts
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@ import { toUtf8 } from '@cosmjs/encoding';

const config = require('../../config');

const NEW_COLLECTION_FEE = coins('1000000000', 'ustars');

function clean(obj: any) {
return JSON.parse(JSON.stringify(obj));
}
@@ -151,6 +149,8 @@ export async function create_minter(params: OpenEditionMinterParams) {

const tempMsg = { create_minter: initMsg };

const creationFee = paramsResponse.params.creation_fee.amount;

// TODO use recursive cleanup of undefined and null values
if (
tempMsg.create_minter?.collection_params.info?.royalty_info
@@ -171,7 +171,7 @@ export async function create_minter(params: OpenEditionMinterParams) {
msg: toUtf8(
JSON.stringify(obj)
),
funds:NEW_COLLECTION_FEE,
funds:coins(creationFee, 'ustars')
},
};

@@ -186,9 +186,9 @@ export async function create_minter(params: OpenEditionMinterParams) {
console.log(JSON.stringify(msg, null, 2));
console.log(
'Cost of minter instantiation: ' +
NEW_COLLECTION_FEE[0].amount +
creationFee +
' ' +
NEW_COLLECTION_FEE[0].denom
'ustars'
);
console.log("Total gas fee to be paid: ",await client.simulate(account, [encodeMsg],undefined)+" ustars");
const answer = await inquirer.prompt([
@@ -206,7 +206,7 @@ export async function create_minter(params: OpenEditionMinterParams) {
msg,
'auto',
config.name,
NEW_COLLECTION_FEE
coins(creationFee, 'ustars')
);
const wasmEvent = result.logs[0].events.find((e) => e.type === 'wasm');
console.info(

0 comments on commit c1160a1

Please sign in to comment.