@emurgo/yoroi-lib-core
Advanced tools
Comparing version 0.2.3-alpha.24 to 0.3.0-alpha.25
@@ -30,2 +30,3 @@ import { BigNumber } from 'bignumber.js'; | ||
}, absSlotNumber: BigNumber, utxos: Array<CardanoAddressedUtxo>, withdrawalRequests: Array<WithdrawalRequest>, changeAddr: AddressingAddress, config: CardanoHaskellConfig, txOptions: TxOptions): Promise<UnsignedTx>; | ||
createUnsignedVotingTx(absSlotNumber: BigNumber, utxos: Array<CardanoAddressedUtxo>, changeAddr: AddressingAddress, config: CardanoHaskellConfig, txOptions: TxOptions, votingPublicKey: string, stakingPublicKey: string, rewardAddress: string, nonce: number, signer: (a: Uint8Array) => string): Promise<UnsignedTx>; | ||
} |
@@ -105,2 +105,35 @@ "use strict"; | ||
} | ||
createUnsignedVotingTx(absSlotNumber, utxos, changeAddr, config, txOptions, votingPublicKey, stakingPublicKey, rewardAddress, nonce, signer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const registrationData = yield this.Wasm.encodeJsonStrToMetadatum(JSON.stringify({ | ||
'1': `0x${votingPublicKey}`, | ||
'2': `0x${stakingPublicKey}`, | ||
'3': `0x${rewardAddress}`, | ||
'4': `0x${nonce}` | ||
}), models_1.MetadataJsonSchema.BasicConversions); | ||
const generalMetadata = yield this.Wasm.GeneralTransactionMetadata.new(); | ||
yield generalMetadata.insert(yield this.Wasm.BigNum.fromStr(models_1.CatalystLabels.DATA.toString()), registrationData); | ||
const hashedMetadataStr = yield (0, hash_wasm_1.blake2b)(yield generalMetadata.toBytes(), 256); | ||
const hashedMetadata = Buffer.from(hashedMetadataStr, 'hex'); | ||
yield generalMetadata.insert(yield this.Wasm.BigNum.fromStr(models_1.CatalystLabels.SIG.toString()), yield this.Wasm.encodeJsonStrToMetadatum(JSON.stringify({ | ||
'1': `0x${signer(hashedMetadata)}` | ||
}), models_1.MetadataJsonSchema.BasicConversions)); | ||
const metadataList = yield this.Wasm.MetadataList.new(); | ||
yield metadataList.add(yield this.Wasm.TransactionMetadatum.fromBytes(yield generalMetadata.toBytes())); | ||
yield metadataList.add(yield this.Wasm.TransactionMetadatum.newList(yield this.Wasm.MetadataList.new())); | ||
const auxData = yield this.Wasm.AuxiliaryData.fromBytes(yield metadataList.toBytes()); | ||
const protocolParams = { | ||
keyDeposit: yield this._wasmV4.BigNum.fromStr(config.keyDeposit), | ||
linearFee: yield this._wasmV4.LinearFee.new(yield this._wasmV4.BigNum.fromStr(config.linearFee.coefficient), yield this._wasmV4.BigNum.fromStr(config.linearFee.constant)), | ||
minimumUtxoVal: yield this._wasmV4.BigNum.fromStr(config.minimumUtxoVal), | ||
poolDeposit: yield this._wasmV4.BigNum.fromStr(config.poolDeposit), | ||
networkId: config.networkId | ||
}; | ||
const unsignedTx = yield this.newAdaUnsignedTx([], changeAddr, utxos, absSlotNumber, protocolParams, [], [], auxData, { | ||
neededHashes: new Set(), | ||
wits: new Set() | ||
}, txOptions, false); | ||
return unsignedTx; | ||
}); | ||
} | ||
createUnsignedWithdrawalTx(accountState, absSlotNumber, utxos, withdrawalRequests, changeAddr, config, txOptions) { | ||
@@ -111,3 +144,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
neededHashes: new Set(), | ||
wits: new Set(), | ||
wits: new Set() | ||
}; | ||
@@ -192,3 +225,3 @@ const requiredWits = []; | ||
neededHashes: new Set([]), | ||
wits: new Set([]), | ||
wits: new Set([]) | ||
}, txOptions); | ||
@@ -233,3 +266,3 @@ } | ||
neededHashes: new Set([]), | ||
wits: new Set([]), | ||
wits: new Set([]) | ||
}, txOptions, false); | ||
@@ -236,0 +269,0 @@ YoroiLib.logger.debug(`createUnsignedTxForUtxos success`, unsignedTx); |
@@ -102,1 +102,5 @@ import { BigNumber } from 'bignumber.js'; | ||
} | ||
export declare enum CatalystLabels { | ||
DATA = 61284, | ||
SIG = 61285 | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MetadataJsonSchema = exports.PRIMARY_ASSET_CONSTANTS = void 0; | ||
exports.CatalystLabels = exports.MetadataJsonSchema = exports.PRIMARY_ASSET_CONSTANTS = void 0; | ||
exports.PRIMARY_ASSET_CONSTANTS = { | ||
@@ -15,1 +15,6 @@ Cardano: '', | ||
})(MetadataJsonSchema = exports.MetadataJsonSchema || (exports.MetadataJsonSchema = {})); | ||
var CatalystLabels; | ||
(function (CatalystLabels) { | ||
CatalystLabels[CatalystLabels["DATA"] = 61284] = "DATA"; | ||
CatalystLabels[CatalystLabels["SIG"] = 61285] = "SIG"; | ||
})(CatalystLabels = exports.CatalystLabels || (exports.CatalystLabels = {})); |
{ | ||
"name": "@emurgo/yoroi-lib-core", | ||
"version": "0.2.3-alpha.24", | ||
"version": "0.3.0-alpha.25", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
243721
4379