conseiljs
Advanced tools
Comparing version 5.0.2-beta.3 to 5.0.3-beta.0
@@ -19,9 +19,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosLanguageUtil_1 = require("../TezosLanguageUtil"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosConstants_1 = require("../../../types/tezos/TezosConstants"); | ||
const TezosNodeReader_1 = require("../TezosNodeReader"); | ||
const TezosNodeWriter_1 = require("../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosConstants_1 = require("../../../types/tezos/TezosConstants"); | ||
const TezosContractUtils_1 = require("./TezosContractUtils"); | ||
var BabylonDelegationHelper; | ||
@@ -31,11 +30,3 @@ (function (BabylonDelegationHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(JSON.stringify(contract.script.code), null, 16)).toString('hex'); | ||
if (k !== 'd99cb8b4c7e40166f59c0f3c30724225') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'd99cb8b4c7e40166f59c0f3c30724225'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, 'd99cb8b4c7e40166f59c0f3c30724225'); | ||
}); | ||
@@ -45,7 +36,3 @@ } | ||
function verifyScript(script) { | ||
const k = Buffer.from(blakejs.blake2s(TezosLanguageUtil_1.TezosLanguageUtil.preProcessMichelsonScript(script).join('\n'), null, 16)).toString('hex'); | ||
if (k !== 'a585489ffaee60d07077059539d5bfc8') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'a585489ffaee60d07077059539d5bfc8'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyScript(script, 'a585489ffaee60d07077059539d5bfc8'); | ||
} | ||
@@ -52,0 +39,0 @@ BabylonDelegationHelper.verifyScript = verifyScript; |
@@ -19,8 +19,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosMessageUtil_1 = require("../TezosMessageUtil"); | ||
const TezosNodeReader_1 = require("../TezosNodeReader"); | ||
const TezosNodeWriter_1 = require("../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosContractUtils_1 = require("./TezosContractUtils"); | ||
var CryptonomicNameServiceHelper; | ||
@@ -30,11 +30,3 @@ (function (CryptonomicNameServiceHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(contract['script'].toString(), null, 16)).toString('hex'); | ||
if (k !== 'c020219e31ee3b462ed93c33124f117f') { | ||
throw new Error(`Contract at ${address} does not match the expected code hash: ${k}, 'c020219e31ee3b462ed93c33124f117f'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, 'c020219e31ee3b462ed93c33124f117f'); | ||
}); | ||
@@ -56,3 +48,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, registrationFee, operationFee, 6000, 300000, 'registerName', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -74,3 +66,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transferNameOwnership', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -92,3 +84,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'updateResolver', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -110,3 +102,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, registrationFee, operationFee, freight, gas, 'updateRegistrationPeriod', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -128,3 +120,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'deleteName', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -170,6 +162,3 @@ } | ||
CryptonomicNameServiceHelper.getSimpleStorage = getSimpleStorage; | ||
function clearRPCOperationGroupHash(hash) { | ||
return hash.replace(/\"/g, '').replace(/\n/, ''); | ||
} | ||
})(CryptonomicNameServiceHelper = exports.CryptonomicNameServiceHelper || (exports.CryptonomicNameServiceHelper = {})); | ||
//# sourceMappingURL=CryptonomicNameServiceHelper.js.map |
@@ -19,9 +19,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosLanguageUtil_1 = require("../TezosLanguageUtil"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosMessageUtil_1 = require("../TezosMessageUtil"); | ||
const TezosNodeReader_1 = require("../TezosNodeReader"); | ||
const TezosNodeWriter_1 = require("../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosContractUtils_1 = require("./TezosContractUtils"); | ||
var StakerDAOTokenHelper; | ||
@@ -31,11 +30,3 @@ (function (StakerDAOTokenHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(JSON.stringify(contract.script.code), null, 16)).toString('hex'); | ||
if (k !== '0e3e137841a959521324b4ce20ca2df7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, '0e3e137841a959521324b4ce20ca2df7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, '0e3e137841a959521324b4ce20ca2df7'); | ||
}); | ||
@@ -45,7 +36,3 @@ } | ||
function verifyScript(script) { | ||
const k = Buffer.from(blakejs.blake2s(TezosLanguageUtil_1.TezosLanguageUtil.preProcessMichelsonScript(script).join('\n'), null, 16)).toString('hex'); | ||
if (k !== 'b77ada691b1d630622bea243696c84d7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'b77ada691b1d630622bea243696c84d7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyScript(script, 'b77ada691b1d630622bea243696c84d7'); | ||
} | ||
@@ -82,10 +69,7 @@ StakerDAOTokenHelper.verifyScript = verifyScript; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
StakerDAOTokenHelper.transferBalance = transferBalance; | ||
function clearRPCOperationGroupHash(hash) { | ||
return hash.replace(/\"/g, '').replace(/\n/, ''); | ||
} | ||
})(StakerDAOTokenHelper = exports.StakerDAOTokenHelper || (exports.StakerDAOTokenHelper = {})); | ||
//# sourceMappingURL=StakerDAOTokenHelper.js.map |
@@ -19,4 +19,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosLanguageUtil_1 = require("../TezosLanguageUtil"); | ||
@@ -26,3 +26,3 @@ const TezosMessageUtil_1 = require("../TezosMessageUtil"); | ||
const TezosNodeWriter_1 = require("../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosContractUtils_1 = require("./TezosContractUtils"); | ||
var TzbtcTokenHelper; | ||
@@ -32,11 +32,3 @@ (function (TzbtcTokenHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(JSON.stringify(contract.script.code), null, 16)).toString('hex'); | ||
if (k !== '187c967006ca95a648c770fdd76947ef') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, '187c967006ca95a648c770fdd76947ef'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, '187c967006ca95a648c770fdd76947ef'); | ||
}); | ||
@@ -46,7 +38,3 @@ } | ||
function verifyScript(script) { | ||
const k = Buffer.from(blakejs.blake2s(TezosLanguageUtil_1.TezosLanguageUtil.preProcessMichelsonScript(script).join('\n'), null, 16)).toString('hex'); | ||
if (k !== 'ffcad1e376a6c8915780fe6676aceec6') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'ffcad1e376a6c8915780fe6676aceec6'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyScript(script, 'ffcad1e376a6c8915780fe6676aceec6'); | ||
} | ||
@@ -92,3 +80,3 @@ TzbtcTokenHelper.verifyScript = verifyScript; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -101,3 +89,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -110,3 +98,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -119,3 +107,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -137,6 +125,3 @@ } | ||
} | ||
function clearRPCOperationGroupHash(hash) { | ||
return hash.replace(/\"/g, '').replace(/\n/, ''); | ||
} | ||
})(TzbtcTokenHelper = exports.TzbtcTokenHelper || (exports.TzbtcTokenHelper = {})); | ||
//# sourceMappingURL=TzbtcTokenHelper.js.map |
import { KeyStore, Signer } from '../../../../types/ExternalInterfaces'; | ||
interface SingleAssetSimpleStorage { | ||
administrator: string; | ||
paused: boolean; | ||
pendingAdmin: string; | ||
balanceMap: number; | ||
operatorMap: number; | ||
metadataMap: number; | ||
supply: number; | ||
} | ||
interface SingleAssetTokenDefinition { | ||
tokenid: number; | ||
symbol: string; | ||
name: string; | ||
scale: number; | ||
} | ||
interface BalancePair { | ||
address: string; | ||
balance: number; | ||
} | ||
interface TransferPair { | ||
address: string; | ||
tokenid: number; | ||
balance: number; | ||
} | ||
export declare namespace SingleAssetTokenHelper { | ||
@@ -6,4 +30,10 @@ function verifyDestination(server: string, address: string): Promise<boolean>; | ||
function deployContract(server: string, signer: Signer, keystore: KeyStore, fee: number, administrator: string, name: string, symbol: string, tokenid: number, scale: number, pause?: boolean, supply?: number, gas?: number, freight?: number): Promise<string>; | ||
function getSimpleStorage(server: string, address: string): Promise<any>; | ||
function getSimpleStorage(server: string, address: string): Promise<SingleAssetSimpleStorage>; | ||
function getTokenDefinition(server: string, mapid: number, token?: number): Promise<SingleAssetTokenDefinition>; | ||
function activate(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, gas?: number, freight?: number): Promise<string>; | ||
function deactivate(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, gas?: number, freight?: number): Promise<string>; | ||
function mint(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, issue: BalancePair[], gas?: number, freight?: number): Promise<string>; | ||
function transfer(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, source: string, transfers: TransferPair[], gas?: number, freight?: number): Promise<string>; | ||
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>; | ||
} | ||
export {}; |
@@ -19,7 +19,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const TezosLanguageUtil_1 = require("../../TezosLanguageUtil"); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosMessageUtil_1 = require("../../TezosMessageUtil"); | ||
const TezosNodeReader_1 = require("../../TezosNodeReader"); | ||
const TezosNodeWriter_1 = require("../../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../../types/tezos/TezosChainTypes")); | ||
const TezosContractUtils_1 = require("../TezosContractUtils"); | ||
var SingleAssetTokenHelper; | ||
@@ -29,11 +30,3 @@ (function (SingleAssetTokenHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(JSON.stringify(contract.script.code), null, 16)).toString('hex'); | ||
if (k !== '0e3e137841a959521324b4ce20ca2df7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, '0e3e137841a959521324b4ce20ca2df7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, '17aab0975df6139f4ff29be76a67f348'); | ||
}); | ||
@@ -43,17 +36,13 @@ } | ||
function verifyScript(script) { | ||
const k = Buffer.from(blakejs.blake2s(TezosLanguageUtil_1.TezosLanguageUtil.preProcessMichelsonScript(script).join('\n'), null, 16)).toString('hex'); | ||
if (k !== 'b77ada691b1d630622bea243696c84d7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'b77ada691b1d630622bea243696c84d7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyScript(script, '000'); | ||
} | ||
SingleAssetTokenHelper.verifyScript = verifyScript; | ||
function deployContract(server, signer, keystore, fee, administrator, name, symbol, tokenid, scale, pause = true, supply = 0, gas = 400000, freight = 8000) { | ||
function deployContract(server, signer, keystore, fee, administrator, name, symbol, tokenid, scale, pause = true, supply = 0, gas = 800000, freight = 20000) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = `{ parameter (or (or (or %admin (bool %pause) (address %set_admin)) (or %assets (or (or (pair %balance_of (contract %callback (list (pair (nat %balance) (pair %request (address %owner) (nat %token_id))))) (list %requests (pair (address %owner) (nat %token_id)))) (pair %is_operator (contract %callback (pair (bool %is_operator) (pair %operator (pair (address %operator) (address %owner)) (or %tokens (unit %all_tokens) (set %some_tokens nat))))) (pair %operator (pair (address %operator) (address %owner)) (or %tokens (unit %all_tokens) (set %some_tokens nat))))) (or (contract %permissions_descriptor (pair (pair (option %custom (pair (option %config_api address) (string %tag))) (or %operator (or (unit %no_transfer) (unit %owner_or_operator_transfer)) (unit %owner_transfer))) (pair (or %receiver (or (unit %optional_owner_hook) (unit %owner_no_op)) (unit %required_owner_hook)) (or %sender (or (unit %optional_owner_hook) (unit %owner_no_op)) (unit %required_owner_hook))))) (pair %token_metadata (contract %callback (list (pair (pair (pair (nat %decimals) (map %extras string string)) (pair (string %name) (string %symbol))) (nat %token_id)))) (list %token_ids nat)))) (or (or (pair %total_supply (contract %callback (list (pair (nat %token_id) (nat %total_supply)))) (list %token_ids nat)) (list %transfer (pair (pair (nat %amount) (address %from_)) (pair (address %to_) (nat %token_id))))) (list %update_operators (or (pair %add_operator (pair (address %operator) (address %owner)) (or %tokens (unit %all_tokens) (set %some_tokens nat))) (pair %remove_operator (pair (address %operator) (address %owner)) (or %tokens (unit %all_tokens) (set %some_tokens nat)))))))) (or %tokens (list %burn_tokens (pair (nat %amount) (address %owner))) (list %mint_tokens (pair (nat %amount) (address %owner))))) ; | ||
storage (pair (pair %admin (address %admin) (bool %paused)) (pair %assets (pair (pair (big_map %ledger address nat) (pair %metadata (pair (pair (nat %decimals) (map %extras string string)) (pair (string %name) (string %symbol))) (nat %token_id))) (pair (big_map %operators (pair address address) bool) (pair %permissions_descriptor (pair (option %custom (pair (option %config_api address) (string %tag))) (or %operator (or (unit %no_transfer) (unit %owner_or_operator_transfer)) (unit %owner_transfer))) (pair (or %receiver (or (unit %optional_owner_hook) (unit %owner_no_op)) (unit %required_owner_hook)) (or %sender (or (unit %optional_owner_hook) (unit %owner_no_op)) (unit %required_owner_hook)))))) (nat %total_supply))) ; | ||
code { LAMBDA (pair address (big_map address nat)) nat { DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; GET ; IF_NONE { PUSH nat 0 } { DUP ; DIP { DROP } } ; DIP { DROP } } ; DUP ; LAMBDA (pair (lambda (pair address (big_map address nat)) nat) (pair (list (pair (pair (nat %amount) (option %from_ address)) (pair (option %to_ address) (nat %token_id)))) (big_map address nat))) (big_map address nat) { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; CAR ; CDR ; IF_NONE { DIG 1 ; DUP ; DUG 2 } { DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 9 ; DUP ; DUG 10 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; SUB ; ISNAT ; IF_NONE { PUSH string "INSUFFICIENT_BALANCE" ; FAILWITH } { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { DIG 2 ; DUP ; DUG 3 ; DIG 4 ; DUP ; DUG 5 ; NONE nat ; SWAP ; UPDATE } { DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE } ; DIP { DROP } } ; DIP { DROP 5 } } ; DIG 1 ; DUP ; DUG 2 ; CDR ; CAR ; IF_NONE { DUP } { DIG 1 ; DUP ; DUG 2 ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 10 ; DUP ; DUG 11 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; ADD ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE ; DIP { DROP 6 } } ; DUP ; DIP { DROP 5 } } ; DIP { DROP 2 } } ; SWAP ; APPLY ; LAMBDA (or (unit %all_tokens) (set %some_tokens nat)) unit { DUP ; IF_LEFT { DROP ; UNIT } { PUSH nat 1 ; DIG 1 ; DUP ; DUG 2 ; SIZE ; COMPARE ; NEQ ; IF { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } { DUP ; PUSH nat 0 ; MEM ; IF { UNIT } { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } } ; DIP { DROP } } ; DIP { DROP } } ; LAMBDA (list nat) unit { DUP ; IF_CONS { PUSH nat 0 ; DIG 2 ; DUP ; DUG 3 ; SIZE ; COMPARE ; NEQ ; IF { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { UNIT } { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } } ; DIP { DROP 2 } } { PUSH string "NO_TOKEN_ID" ; FAILWITH } ; DIP { DROP } } ; LAMBDA (list (pair (nat %amount) (address %owner))) nat { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; ITER { SWAP ; PAIR ; DUP ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ADD ; DIP { DROP } } ; DIP { DROP } } ; LAMBDA (pair (address %admin) (bool %paused)) unit { DUP ; CAR ; SENDER ; COMPARE ; NEQ ; IF { PUSH string "NOT_AN_ADMIN" ; FAILWITH } { UNIT } ; DIP { DROP } } ; DIG 6 ; DUP ; DUG 7 ; CDR ; DIG 7 ; DUP ; DUG 8 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 4 ; DUP ; DUG 5 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; SWAP ; CAR ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; SWAP ; CDR ; SWAP ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP } } ; DIP { DROP 2 } ; DIG 4 ; DUP ; DUG 5 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CDR ; SWAP ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } { DIG 2 ; DUP ; DUG 3 ; CAR ; CDR ; IF { PUSH string "PAUSED" ; FAILWITH } { UNIT } ; DIG 3 ; DUP ; DUG 4 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DUP ; IF_LEFT { DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DUP ; CDR ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } { DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIG 18 ; DUP ; DUG 19 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DIP { DROP } } ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; DIG 2 ; DUP ; DUG 3 ; TRANSFER_TOKENS ; DIP { DROP 3 } ; DIG 4 ; DUP ; DUG 5 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 2 } } { DUP ; CDR ; CDR ; DIG 13 ; DUP ; DUG 14 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; DIG 3 ; DUP ; DUG 4 ; CDR ; DIG 7 ; DUP ; DUG 8 ; CAR ; CDR ; CAR ; DIG 5 ; DUP ; DUG 6 ; CDR ; CAR ; CAR ; DIG 6 ; DUP ; DUG 7 ; CDR ; CAR ; CDR ; PAIR ; GET ; IF_NONE { PUSH bool False } { DUP ; DIP { DROP } } ; PAIR ; TRANSFER_TOKENS ; DIG 5 ; DUP ; DUG 6 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } { DUP ; IF_LEFT { DUP ; PUSH mutez 0 ; DIG 5 ; DUP ; DUG 6 ; CAR ; CDR ; CDR ; TRANSFER_TOKENS ; DIG 4 ; DUP ; DUG 5 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 2 } } { DUP ; CDR ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; NIL (pair (pair (pair (nat %decimals) (map %extras string string)) (pair (string %name) (string %symbol))) (nat %token_id)) ; DIG 7 ; DUP ; DUG 8 ; CAR ; CAR ; CDR ; CONS ; TRANSFER_TOKENS ; DIG 5 ; DUP ; DUG 6 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } ; DIP { DROP } } { DUP ; IF_LEFT { DUP ; IF_LEFT { DUP ; CDR ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; NIL (pair (nat %token_id) (nat %total_supply)) ; DIG 7 ; DUP ; DUG 8 ; CDR ; PUSH nat 0 ; PAIR ; CONS ; TRANSFER_TOKENS ; DIG 5 ; DUP ; DUG 6 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 3 } } { DUP ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; CDR ; COMPARE ; NEQ ; IF { PUSH string "TOKEN_UNDEFINED" ; FAILWITH } { DUP ; CDR ; CDR ; DIG 1 ; DUP ; DUG 2 ; CDR ; CAR ; SOME ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CDR ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; PAIR ; PAIR } ; DIP { DROP } } ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; CAR ; DIG 5 ; DUP ; DUG 6 ; CAR ; CDR ; CDR ; CAR ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DUP ; CAR ; CDR ; IF_LEFT { DUP ; IF_LEFT { PUSH string "TX_DENIED" ; FAILWITH } { PUSH bool True ; PUSH bool True ; PAIR ; DIP { DROP } } ; DIP { DROP } } { PUSH bool False ; PUSH bool True ; PAIR ; DIP { DROP } } ; SENDER ; EMPTY_SET address ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; ITER { SWAP ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; CAR ; CDR ; IF_NONE { DUP } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PUSH bool True ; SWAP ; UPDATE ; DIP { DROP } } ; DIP { DROP 2 } } ; DUP ; ITER { DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; DIG 4 ; DUP ; DUG 5 ; CAR ; AND ; IF { UNIT } { DIG 3 ; DUP ; DUG 4 ; CDR ; NOT ; IF { PUSH string "NOT_OWNER" ; FAILWITH } { DIG 4 ; DUP ; DUG 5 ; CDR ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; GET ; IF_NONE { PUSH string "NOT_OPERATOR" ; FAILWITH } { DROP ; UNIT } } } ; DROP 2 } ; DROP 4 ; PUSH unit Unit ; DIG 5 ; DUP ; DUG 6 ; CAR ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 16 ; DUP ; DUG 17 ; SWAP ; EXEC ; DIG 6 ; DUP ; DUG 7 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 4 } } ; DIP { DROP } } { DIG 2 ; DUP ; DUG 3 ; CAR ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; IF_LEFT { DUP ; CDR ; DIG 16 ; DUP ; DUG 17 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; PUSH bool True ; SOME ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; PAIR ; UPDATE ; DIP { DROP 2 } } { DUP ; CDR ; DIG 16 ; DUP ; DUG 17 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; PAIR ; NONE bool ; SWAP ; UPDATE ; DIP { DROP 2 } } ; DIP { DROP 2 } } ; DIP { DROP } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CDR } ; PAIR ; SWAP ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 2 } } ; DIP { DROP } } ; DIP { DROP 2 } ; DIG 4 ; DUP ; DUG 5 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 3 ; DUP ; DUG 4 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DIG 1 ; DUP ; DUG 2 ; MAP { PUSH nat 0 ; NONE address ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CDR ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR ; PAIR ; DIP { DROP } } ; SENDER ; SELF ; ADDRESS ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIP { DROP } ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; PAIR ; DIG 15 ; DUP ; DUG 16 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; DIG 13 ; DUP ; DUG 14 ; SWAP ; EXEC ; DUP ; DIG 4 ; DUP ; DUG 5 ; CDR ; SUB ; ISNAT ; DUP ; IF_NONE { PUSH string "INSUFFICIENT_BALANCE" ; FAILWITH } { DUP ; DIP { DROP } } ; DIG 5 ; DUP ; DUG 6 ; DIG 4 ; DUP ; DUG 5 ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; SWAP ; CAR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 9 } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DIG 1 ; DUP ; DUG 2 ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SOME ; PAIR ; NONE address ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR ; PAIR ; DIP { DROP } } ; SENDER ; SELF ; ADDRESS ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIP { DROP } ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; PAIR ; DIG 15 ; DUP ; DUG 16 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; DIG 13 ; DUP ; DUG 14 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIG 5 ; DUP ; DUG 6 ; CDR ; ADD ; SWAP ; CAR ; PAIR ; DUP ; NIL operation ; PAIR ; DIP { DROP 8 } } ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP 8 } } ;`; | ||
const storage = `(Pair (Pair "${administrator}" ${pause ? 'True' : 'False'}) (Pair (Pair (Pair { } (Pair (Pair (Pair ${scale} { }) (Pair "${name}" "${symbol}")) ${tokenid})) (Pair { } (Pair (Pair None (Right Unit)) (Pair (Right Unit) (Right Unit))))) ${supply}))`; | ||
const contract = `parameter (or (or (or %admin (or (unit %confirm_admin) (bool %pause)) (address %set_admin)) (or %assets (or (pair %balance_of (list %requests (pair (address %owner) (nat %token_id))) (contract %callback (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) (contract %token_metadata_registry address)) (or (list %transfer (pair (address %from_) (list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount)))))) (list %update_operators (or (pair %add_operator (address %owner) (address %operator)) (pair %remove_operator (address %owner) (address %operator))))))) (or %tokens (list %burn_tokens (pair (nat %amount) (address %owner))) (list %mint_tokens (pair (nat %amount) (address %owner))))) ; | ||
storage (pair (pair %admin (pair (address %admin) (bool %paused)) (option %pending_admin address)) (pair %assets (pair (big_map %ledger address nat) (big_map %operators (pair address address) unit)) (pair (big_map %token_metadata nat (pair (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string)))))) (nat %total_supply)))) ; | ||
code { PUSH string "FA2_TOKEN_UNDEFINED" ; PUSH string "FA2_INSUFFICIENT_BALANCE" ; LAMBDA (pair address address) (pair address address) { DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DIP { DROP } } ; LAMBDA (pair address (big_map address nat)) nat { DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; GET ; IF_NONE { PUSH nat 0 } { DUP ; DIP { DROP } } ; DIP { DROP } } ; DUP ; LAMBDA (pair (lambda (pair address (big_map address nat)) nat) (pair (pair address nat) (big_map address nat))) (big_map address nat) { DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; ADD ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE ; DIP { DROP 6 } } ; SWAP ; APPLY ; DIP { DIP { DIP { DUP } ; SWAP } ; DUP ; DIP { PAIR } ; SWAP } ; SWAP ; LAMBDA (pair (pair (lambda (pair address (big_map address nat)) nat) string) (pair (pair address nat) (big_map address nat))) (big_map address nat) { DUP ; CAR ; SWAP ; CDR ; DIP { DUP ; CDR ; SWAP ; CAR } ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; SUB ; ISNAT ; IF_NONE { DIG 5 ; DUP ; DUG 6 ; FAILWITH } { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { DIG 2 ; DUP ; DUG 3 ; DIG 4 ; DUP ; DUG 5 ; NONE nat ; SWAP ; UPDATE } { DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE } ; DIP { DROP } } ; DIP { DROP 6 } } ; SWAP ; APPLY ; LAMBDA (list (pair nat address)) nat { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; ITER { SWAP ; PAIR ; DUP ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ADD ; DIP { DROP } } ; DIP { DROP } } ; LAMBDA (pair (pair address bool) (option address)) unit { DUP ; CAR ; CAR ; SENDER ; COMPARE ; NEQ ; IF { PUSH string "NOT_AN_ADMIN" ; FAILWITH } { UNIT } ; DIP { DROP } } ; DIG 8 ; DUP ; DUG 9 ; CDR ; DIG 9 ; DUP ; DUG 10 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DIG 2 ; DUP ; DUG 3 ; CDR ; IF_NONE { PUSH string "NO_PENDING_ADMIN" ; FAILWITH } { DUP ; SENDER ; COMPARE ; EQ ; IF { DIG 3 ; DUP ; DUG 4 ; CAR ; NONE address ; SWAP ; PAIR ; DUP ; CDR ; SWAP ; CAR ; CDR ; SENDER ; PAIR ; PAIR } { PUSH string "NOT_AN_ADMIN" ; FAILWITH } ; DIP { DROP } } ; DUP ; NIL operation ; PAIR ; DIP { DROP 2 } } { DIG 2 ; DUP ; DUG 3 ; DIG 8 ; DUP ; DUG 9 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP 2 } } ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; DIG 7 ; DUP ; DUG 8 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; SOME ; SWAP ; CAR ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP 2 } } ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CDR ; SWAP ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 2 } } { DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; CDR ; IF { PUSH string "PAUSED" ; FAILWITH } { UNIT } ; DIG 3 ; DUP ; DUG 4 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DUP ; CDR ; MAP { DUP ; DIP { DROP } } ; DUP ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DUP ; CDR ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 19 ; DUP ; DUG 20 ; FAILWITH } { DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; CDR ; DIG 1 ; DUP ; DUG 2 ; CDR ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; DIG 2 ; DUP ; DUG 3 ; TRANSFER_TOKENS ; DIP { DROP 3 } ; DIG 4 ; DUP ; DUG 5 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 3 } } { DUP ; PUSH mutez 0 ; SELF ; ADDRESS ; TRANSFER_TOKENS ; DIG 3 ; DUP ; DUG 4 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 2 } } ; DIP { DROP } } { DUP ; IF_LEFT { DUP ; MAP { DUP ; CDR ; MAP { DUP ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; CDR ; PAIR ; PAIR ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP } } ; DUP ; MAP { DUP ; CDR ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 18 ; DUP ; DUG 19 ; FAILWITH } { DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CDR ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; PAIR ; PAIR } ; DIP { DROP } } ; DUP ; DIG 2 ; DUP ; DUG 3 ; CAR ; SOME ; PAIR ; DIP { DROP 2 } } ; SENDER ; DUP ; LAMBDA (pair address (pair address (big_map (pair address address) unit))) unit { DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { UNIT } { DIG 1 ; DUP ; DUG 2 ; CDR ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; MEM ; IF { UNIT } { PUSH string "FA2_NOT_OPERATOR" ; FAILWITH } } ; DIP { DROP 3 } } ; SWAP ; APPLY ; DIP { DROP } ; DIG 5 ; DUP ; DUG 6 ; CAR ; CAR ; DIG 6 ; DUP ; DUG 7 ; CAR ; CDR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIG 3 ; DUP ; DUG 4 ; PAIR ; PAIR ; DUP ; CDR ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DUP ; CAR ; IF_NONE { UNIT } { DIG 3 ; DUP ; DUG 4 ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; SWAP ; EXEC ; DIP { DROP } } ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; ITER { SWAP ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 25 ; DUP ; DUG 26 ; FAILWITH } { DIG 4 ; DUP ; DUG 5 ; CAR ; IF_NONE { DIG 1 ; DUP ; DUG 2 } { DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIG 22 ; DUP ; DUG 23 ; SWAP ; EXEC ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; CDR ; IF_NONE { DUP } { DIG 1 ; DUP ; DUG 2 ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIG 24 ; DUP ; DUG 25 ; SWAP ; EXEC ; DIP { DROP } } ; DIP { DROP } } ; DIP { DROP 3 } } ; DIP { DROP 3 } } ; DIP { DROP } ; DIG 6 ; DUP ; DUG 7 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 5 } } { DUP ; MAP { DUP ; IF_LEFT { DUP ; LEFT (pair (address %owner) (address %operator)) ; DIP { DROP } } { DUP ; RIGHT (pair (address %owner) (address %operator)) ; DIP { DROP } } ; DUP ; IF_LEFT { DUP ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; LEFT (pair (address %operator) (address %owner)) ; DIP { DROP } } { DUP ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; RIGHT (pair (address %operator) (address %owner)) ; DIP { DROP } } ; DIP { DROP 2 } } ; SENDER ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; DIG 2 ; DUP ; DUG 3 ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; DIP { DROP } } { DUP ; DIP { DROP } } ; CDR ; COMPARE ; EQ ; IF { UNIT } { PUSH string "FA2_NOT_OWNER" ; FAILWITH } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; UNIT ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 3 ; DUP ; DUG 4 ; CDR ; PAIR ; UPDATE ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; NONE unit ; SWAP ; UPDATE ; DIP { DROP } } ; DIP { DROP 5 } } ; DIG 5 ; DUP ; DUG 6 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 4 } } ; DIP { DROP } } ; DIP { DROP 2 } ; DIG 4 ; DUP ; DUG 5 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 3 ; DUP ; DUG 4 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; PAIR ; DIG 15 ; DUP ; DUG 16 ; SWAP ; EXEC ; DIP { DROP 2 } } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DUP ; DIG 3 ; DUP ; DUG 4 ; CDR ; CDR ; SUB ; ISNAT ; DUP ; IF_NONE { DIG 18 ; DUP ; DUG 19 ; FAILWITH } { DUP ; DIP { DROP } } ; DIG 4 ; DUP ; DUG 5 ; DIG 4 ; DUP ; DUG 5 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; NIL operation ; PAIR ; DIP { DROP 8 } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; PAIR ; DIG 16 ; DUP ; DUG 17 ; SWAP ; EXEC ; DIP { DROP 2 } } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIG 4 ; DUP ; DUG 5 ; CDR ; CDR ; ADD ; DIP { DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; DUP ; NIL operation ; PAIR ; DIP { DROP 7 } } ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP 10 } } ; `; | ||
const storage = `( Pair ( Pair ( Pair "${administrator}" ${pause ? 'True' : 'False'} ) None ) ( Pair ( Pair { } { } ) ( Pair { Elt ${tokenid} ( Pair ${tokenid} ( Pair "${symbol}" ( Pair "${name}" ( Pair ${scale} { } ) ) ) ) } ${supply} ) ) )`; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractOriginationOperation(server, signer, keystore, 0, undefined, fee, freight, gas, contract, storage, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult['operationGroupID']); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult['operationGroupID']); | ||
}); | ||
@@ -64,16 +53,80 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return null; | ||
const storageResult = yield TezosNodeReader_1.TezosNodeReader.getContractStorage(server, address); | ||
return { | ||
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].args[0].string', json: storageResult })[0], | ||
paused: (jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].args[1].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'), | ||
pendingAdmin: jsonpath_plus_1.JSONPath({ path: '$.args[0].args[1].prim', json: storageResult })[0], | ||
balanceMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[0].int', json: storageResult })[0]), | ||
operatorMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[1].int', json: storageResult })[0]), | ||
metadataMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[0].int', json: storageResult })[0]), | ||
supply: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[1].int', json: storageResult })[0]) | ||
}; | ||
}); | ||
} | ||
SingleAssetTokenHelper.getSimpleStorage = getSimpleStorage; | ||
function getTokenDefinition(server, mapid, token = 0) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(token, 'nat'), 'hex')); | ||
const mapResult = yield TezosNodeReader_1.TezosNodeReader.getValueForBigMapKey(server, mapid, packedKey); | ||
if (mapResult === undefined) { | ||
throw new Error(`Map ${mapid} does not contain a record for token ${token}`); | ||
} | ||
return { | ||
tokenid: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].int', json: mapResult })[0]), | ||
symbol: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].string', json: mapResult })[0], | ||
name: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[0].string', json: mapResult })[0], | ||
scale: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[1].args[0].int', json: mapResult })[0]) | ||
}; | ||
}); | ||
} | ||
SingleAssetTokenHelper.getTokenDefinition = getTokenDefinition; | ||
function activate(server, address, signer, keystore, fee, gas = 800000, freight = 20000) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const entryPoint = 'pause'; | ||
const parameters = 'False'; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
SingleAssetTokenHelper.activate = activate; | ||
function deactivate(server, address, signer, keystore, fee, gas = 800000, freight = 20000) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const entryPoint = 'pause'; | ||
const parameters = 'True'; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
SingleAssetTokenHelper.deactivate = deactivate; | ||
function mint(server, address, signer, keystore, fee, issue, gas = 800000, freight = 20000) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const entryPoint = 'mint_tokens'; | ||
const parameters = `{ ${issue.map(i => '( Pair ' + i.balance + ' "' + i.address + '" )').join(' ; ')} }`; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
SingleAssetTokenHelper.mint = mint; | ||
function transfer(server, address, signer, keystore, fee, source, transfers, gas = 800000, freight = 20000) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const entryPoint = 'transfer'; | ||
const parameters = `{ Pair "${source}" { ${transfers.map(t => '( Pair "' + t.address + '" ( Pair ' + t.tokenid + ' ' + t.balance + ' ) )').join(' ; ')} } }`; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
SingleAssetTokenHelper.transfer = transfer; | ||
function getAccountBalance(server, mapid, account) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return 0; | ||
const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, 'address'), 'hex')); | ||
const mapResult = yield TezosNodeReader_1.TezosNodeReader.getValueForBigMapKey(server, mapid, packedKey); | ||
if (mapResult === undefined) { | ||
throw new Error(`Map ${mapid} does not contain a record for ${account}`); | ||
} | ||
const jsonresult = jsonpath_plus_1.JSONPath({ path: '$.int', json: mapResult }); | ||
return Number(jsonresult[0]); | ||
}); | ||
} | ||
SingleAssetTokenHelper.getAccountBalance = getAccountBalance; | ||
function clearRPCOperationGroupHash(hash) { | ||
return hash.replace(/\"/g, '').replace(/\n/, ''); | ||
} | ||
})(SingleAssetTokenHelper = exports.SingleAssetTokenHelper || (exports.SingleAssetTokenHelper = {})); | ||
//# sourceMappingURL=SingleAssetTokenHelper.js.map |
@@ -19,9 +19,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const blakejs = __importStar(require("blakejs")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosLanguageUtil_1 = require("../TezosLanguageUtil"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosMessageUtil_1 = require("../TezosMessageUtil"); | ||
const TezosNodeReader_1 = require("../TezosNodeReader"); | ||
const TezosNodeWriter_1 = require("../TezosNodeWriter"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
const TezosContractUtils_1 = require("./TezosContractUtils"); | ||
var Tzip7ReferenceTokenHelper; | ||
@@ -31,11 +30,3 @@ (function (Tzip7ReferenceTokenHelper) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const contract = yield TezosNodeReader_1.TezosNodeReader.getAccountForBlock(server, 'head', address); | ||
if (!!!contract.script) { | ||
throw new Error(`No code found at ${address}`); | ||
} | ||
const k = Buffer.from(blakejs.blake2s(JSON.stringify(contract.script.code), null, 16)).toString('hex'); | ||
if (k !== '0e3e137841a959521324b4ce20ca2df7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, '0e3e137841a959521324b4ce20ca2df7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyDestination(server, address, '0e3e137841a959521324b4ce20ca2df7'); | ||
}); | ||
@@ -45,7 +36,3 @@ } | ||
function verifyScript(script) { | ||
const k = Buffer.from(blakejs.blake2s(TezosLanguageUtil_1.TezosLanguageUtil.preProcessMichelsonScript(script).join('\n'), null, 16)).toString('hex'); | ||
if (k !== 'b77ada691b1d630622bea243696c84d7') { | ||
throw new Error(`Contract does not match the expected code hash: ${k}, 'b77ada691b1d630622bea243696c84d7'`); | ||
} | ||
return true; | ||
return TezosContractUtils_1.TezosContractUtils.verifyScript(script, 'b77ada691b1d630622bea243696c84d7'); | ||
} | ||
@@ -60,3 +47,3 @@ Tzip7ReferenceTokenHelper.verifyScript = verifyScript; | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractOriginationOperation(server, signer, keystore, 0, undefined, fee, freight, gas, contract, storage, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult['operationGroupID']); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult['operationGroupID']); | ||
}); | ||
@@ -127,3 +114,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -136,3 +123,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -145,3 +132,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -154,3 +141,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -163,3 +150,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -172,3 +159,3 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
@@ -181,10 +168,7 @@ } | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
}); | ||
} | ||
Tzip7ReferenceTokenHelper.burn = burn; | ||
function clearRPCOperationGroupHash(hash) { | ||
return hash.replace(/\"/g, '').replace(/\n/, ''); | ||
} | ||
})(Tzip7ReferenceTokenHelper = exports.Tzip7ReferenceTokenHelper || (exports.Tzip7ReferenceTokenHelper = {})); | ||
//# sourceMappingURL=Tzip7ReferenceTokenHelper.js.map |
@@ -13,3 +13,3 @@ export * from './chain/tezos/TezosContractIntrospector'; | ||
export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/NFTReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/MultiAssetTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper'; | ||
@@ -16,0 +16,0 @@ export * from './chain/tezos/contracts/TzbtcTokenHelper'; |
@@ -25,3 +25,3 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/NFTReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/MultiAssetTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper")); | ||
@@ -28,0 +28,0 @@ __export(require("./chain/tezos/contracts/TzbtcTokenHelper")); |
@@ -15,3 +15,3 @@ export declare function registerLogger(logger: any): void; | ||
export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/NFTReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/MultiAssetTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper'; | ||
@@ -18,0 +18,0 @@ export * from './chain/tezos/contracts/TzbtcTokenHelper'; |
@@ -31,3 +31,3 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/NFTReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/MultiAssetTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper")); | ||
@@ -34,0 +34,0 @@ __export(require("./chain/tezos/contracts/TzbtcTokenHelper")); |
{ | ||
"name": "conseiljs", | ||
"version": "5.0.2-beta.3", | ||
"version": "5.0.3-beta.0", | ||
"description": "Client-side library for dApp development.", | ||
@@ -61,3 +61,6 @@ "browser": "dist/index-web.js", | ||
], | ||
"reporter": [ "text", "text-lcov" ], | ||
"reporter": [ | ||
"text", | ||
"text-lcov" | ||
], | ||
"sourceMap": true, | ||
@@ -86,3 +89,3 @@ "instrument": true | ||
"chai-as-promised": "7.1.1", | ||
"conseiljs-softsigner": "5.0.2-beta.1", | ||
"conseiljs-softsigner": "5.0.2-beta.3", | ||
"copyfiles": "2.3.0", | ||
@@ -89,0 +92,0 @@ "coveralls": "3.1.0", |
@@ -59,3 +59,3 @@ # ConseilJS-core | ||
<script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs/dist-web/conseiljs.min.js" | ||
integrity="sha384-CDpCW4rM4qw7oEyOr5wSQNqnPmQw9vtCoqWyKSDIys50jRONU+j+uxk/aEy0QzRJ" | ||
integrity="sha384-D5Exnkq8hYVfQqoWvZOQsohtT45+lj0YGbHmwdeJPeqCcM0zxXjmCRRsaf+Ch2eg" | ||
crossorigin="anonymous"></script> | ||
@@ -62,0 +62,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
678402
127
6512