@emurgo/yoroi-lib
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -831,5 +831,11 @@ "use strict"; | ||
if ('data' in output.datum) { | ||
const data = yield this.Wasm.PlutusData.fromHex(output.datum.data); | ||
yield txOutput.setDataHash(yield this.Wasm.hashPlutusData(data)); | ||
yield txOutput.setPlutusData(data); | ||
// hash script data and set it | ||
const plutusData = yield this.Wasm.PlutusData.fromHex(output.datum.data); | ||
const plutusList = yield this.Wasm.PlutusList.new(); | ||
yield plutusList.add(plutusData); | ||
const scriptDataHash = yield this.Wasm.hashScriptData(yield this.Wasm.Redeemers.new(), yield this.Wasm.Costmdls.new(), plutusList); | ||
yield txBuilder.setScriptDataHash(scriptDataHash); | ||
// hash the datum and set it | ||
const hash = yield this.Wasm.hashPlutusData(plutusData); | ||
yield txOutput.setDataHash(hash); | ||
} | ||
@@ -836,0 +842,0 @@ else { |
@@ -93,3 +93,5 @@ import * as WasmContract from '@emurgo/cross-csl-core'; | ||
}, metadata: ReadonlyArray<TxMetadata>, auxiliaryData: WasmContract.AuxiliaryData | undefined, catalystRegistrationData: CatalystRegistrationData | undefined, stakingKey: WasmContract.PublicKey | undefined, valueInAccount: MultiTokenValue | undefined, withdrawalRequests: Array<WithdrawalRequest>): Promise<WasmUnsignedTx>; | ||
sign(keyLevel: number, privateKey: string, additionalWits: Set<string>, additionalKeys?: WasmContract.PrivateKey[], stakingKey?: WasmContract.PrivateKey): Promise<SignedTx>; | ||
sign(keyLevel: number, privateKey: string, additionalWits: Set<string>, additionalKeys?: WasmContract.PrivateKey[], stakingKey?: WasmContract.PrivateKey, plutusData?: Exclude<Datum, { | ||
hash: string; | ||
}>[]): Promise<SignedTx>; | ||
private addWitnesses; | ||
@@ -139,3 +141,5 @@ } | ||
readonly withdrawalRequests: Array<WithdrawalRequest>; | ||
sign(keyLevel: number, privateKey: string, additionalWits: Set<string>, additionalKeys?: WasmContract.PrivateKey[], stakingKey?: WasmContract.PrivateKey): Promise<SignedTx>; | ||
sign(keyLevel: number, privateKey: string, additionalWits: Set<string>, additionalKeys?: WasmContract.PrivateKey[], stakingKey?: WasmContract.PrivateKey, plutusData?: Exclude<Datum, { | ||
hash: string; | ||
}>[]): Promise<SignedTx>; | ||
} | ||
@@ -142,0 +146,0 @@ export declare function genWasmUnsignedTx(wasm: WasmContract.WasmModuleProxy, defaultToken: Token, txBuilder: WasmContract.TransactionBuilder, senderUtxos: CardanoAddressedUtxo[], allUtxos: CardanoAddressedUtxo[], change: ReadonlyArray<Change>, defaults: Token, networkId: number, neededStakingKeyHashes: { |
@@ -183,3 +183,3 @@ "use strict"; | ||
} | ||
sign(keyLevel, privateKey, additionalWits, additionalKeys, stakingKey) { | ||
sign(keyLevel, privateKey, additionalWits, additionalKeys, stakingKey, plutusData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -235,2 +235,3 @@ const signingKey = yield this._wasm.Bip32PrivateKey.fromBytes(Buffer.from(privateKey, 'hex')); | ||
const bootstrapWits = yield this._wasm.BootstrapWitnesses.new(); | ||
const plutusDataWits = yield this._wasm.PlutusList.new(); | ||
yield this.addWitnesses(txHash, deduped, keyLevel, signingKey, vkeyWits, bootstrapWits); | ||
@@ -245,2 +246,10 @@ const stakingKeySigSet = new Set(); | ||
} | ||
if (plutusData) { | ||
for (const datum of plutusData) { | ||
if (datum.data) { | ||
const plutusDatum = yield this._wasm.PlutusData.fromHex(datum.data); | ||
yield plutusDataWits.add(plutusDatum); | ||
} | ||
} | ||
} | ||
if (additionalKeys) { | ||
@@ -259,2 +268,4 @@ for (const witnessKey of additionalKeys) { | ||
yield witnessSet.setBootstraps(bootstrapWits); | ||
if ((yield plutusDataWits.len()) > 0) | ||
yield witnessSet.setPlutusData(plutusDataWits); | ||
if ((yield vkeyWits.len()) > 0) | ||
@@ -261,0 +272,0 @@ yield witnessSet.setVkeys(vkeyWits); |
{ | ||
"name": "@emurgo/yoroi-lib", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "main": "dist/index.js", | ||
"@cardano-foundation/ledgerjs-hw-app-cardano": "^6.0.0", | ||
"@emurgo/cross-csl-core": "^2.5.0", | ||
"@emurgo/cross-csl-core": "^2.7.0", | ||
"axios": "^0.24.0", | ||
@@ -38,3 +38,3 @@ "bech32": "^2.0.0", | ||
"devDependencies": { | ||
"@emurgo/cross-csl-nodejs": "^2.5.0", | ||
"@emurgo/cross-csl-nodejs": "^2.7.0", | ||
"@types/chai": "^4.2.21", | ||
@@ -41,0 +41,0 @@ "@types/mocha": "^9.0.0", |
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
241961
4313