@emurgo/yoroi-lib-core
Advanced tools
Comparing version 0.7.5-alpha.40 to 0.7.6-alpha.41
@@ -129,3 +129,3 @@ "use strict"; | ||
} | ||
return yield this.createUnsignedTxForUtxos(absSlotNumber, receivers, defaultToken, tokens, utxos, config, txOptions, undefined, undefined); | ||
return yield this.createUnsignedTxForUtxos(absSlotNumber, receivers, defaultToken, tokens, utxos, config, txOptions, undefined, undefined, []); | ||
}); | ||
@@ -170,3 +170,3 @@ } | ||
votingPublicKey: Buffer.from(yield stakingPublicKey.asBytes()).toString('hex') | ||
}, stakingPublicKey, undefined); | ||
}, stakingPublicKey, undefined, []); | ||
return unsignedTx; | ||
@@ -236,3 +236,3 @@ }); | ||
}; | ||
const unsignedTx = yield this.newAdaUnsignedTx([], defaultToken, changeAddr, utxos, absSlotNumber, protocolParams, certificates, finalWithdrawals, undefined, neededKeys, txOptions, false, undefined, undefined, undefined); | ||
const unsignedTx = yield this.newAdaUnsignedTx([], defaultToken, changeAddr, utxos, absSlotNumber, protocolParams, certificates, finalWithdrawals, undefined, neededKeys, txOptions, false, undefined, undefined, undefined, withdrawalRequests); | ||
return unsignedTx; | ||
@@ -255,3 +255,3 @@ }); | ||
wits: new Set() | ||
}, txOptions, false, undefined, stakingKey, valueInAccount)); | ||
}, txOptions, false, undefined, stakingKey, valueInAccount, [])); | ||
return unsignedTx; | ||
@@ -382,3 +382,3 @@ } | ||
} | ||
createUnsignedTxForUtxos(absSlotNumber, receivers, defaultToken, tokens, utxos, config, txOptions, stakingKey, valueInAccount) { | ||
createUnsignedTxForUtxos(absSlotNumber, receivers, defaultToken, tokens, utxos, config, txOptions, stakingKey, valueInAccount, withdrawalRequests) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -404,3 +404,3 @@ try { | ||
wits: new Set([]) | ||
}, txOptions, stakingKey, valueInAccount); | ||
}, txOptions, stakingKey, valueInAccount, withdrawalRequests); | ||
} | ||
@@ -445,3 +445,3 @@ else { | ||
wits: new Set([]) | ||
}, txOptions, false, undefined, undefined, undefined); | ||
}, txOptions, false, undefined, undefined, undefined, withdrawalRequests); | ||
YoroiLib.logger.debug(`createUnsignedTxForUtxos success`, unsignedTx); | ||
@@ -459,3 +459,3 @@ return unsignedTx; | ||
} | ||
sendAllUnsignedTx(receiver, defaultToken, allUtxos, absSlotNumber, protocolParams, auxData, neededStakingKeyHashes, txOptions, stakingKey, valueInAccount) { | ||
sendAllUnsignedTx(receiver, defaultToken, allUtxos, absSlotNumber, protocolParams, auxData, neededStakingKeyHashes, txOptions, stakingKey, valueInAccount, withdrawalRequests) { | ||
var _a; | ||
@@ -491,3 +491,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
isDefault: true | ||
}, protocolParams.networkId, neededStakingKeyHashes, (_a = txOptions.metadata) !== null && _a !== void 0 ? _a : [], auxData, undefined, stakingKey, valueInAccount); | ||
}, protocolParams.networkId, neededStakingKeyHashes, (_a = txOptions.metadata) !== null && _a !== void 0 ? _a : [], auxData, undefined, stakingKey, valueInAccount, withdrawalRequests); | ||
}); | ||
@@ -560,3 +560,3 @@ } | ||
} | ||
newAdaUnsignedTx(outputs, defaultToken, changeAdaAddr, allUtxos, absSlotNumber, protocolParams, certificates, withdrawals, auxData, neededStakingKeyHashes, txOptions, allowNoOutputs, catalystRegistrationData, stakingKey, valueInAccount) { | ||
newAdaUnsignedTx(outputs, defaultToken, changeAdaAddr, allUtxos, absSlotNumber, protocolParams, certificates, withdrawals, auxData, neededStakingKeyHashes, txOptions, allowNoOutputs, catalystRegistrationData, stakingKey, valueInAccount, withdrawalRequests) { | ||
var _a; | ||
@@ -587,3 +587,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
isDefault: true | ||
}, protocolParams.networkId, neededStakingKeyHashes, (_a = txOptions.metadata) !== null && _a !== void 0 ? _a : [], auxData, catalystRegistrationData, stakingKey, valueInAccount); | ||
}, protocolParams.networkId, neededStakingKeyHashes, (_a = txOptions.metadata) !== null && _a !== void 0 ? _a : [], auxData, catalystRegistrationData, stakingKey, valueInAccount, withdrawalRequests); | ||
}); | ||
@@ -590,0 +590,0 @@ } |
import { BigNumber } from 'bignumber.js'; | ||
import { MultiToken } from './multi-token'; | ||
import { PrivateKey } from './wasm-contract'; | ||
interface Bip44DerivationLevel { | ||
@@ -40,2 +41,3 @@ level: number; | ||
shouldDeregister: boolean; | ||
stakingPrivateKey: PrivateKey; | ||
}; | ||
@@ -42,0 +44,0 @@ export declare type Transaction = { |
import * as WasmContract from './wasm-contract'; | ||
import { CardanoAddressedUtxo, Change, Token, MultiTokenValue, TxMetadata } from './models'; | ||
import { CardanoAddressedUtxo, Change, Token, MultiTokenValue, TxMetadata, WithdrawalRequest } from './models'; | ||
export interface SignedTx { | ||
@@ -87,3 +87,3 @@ id: string; | ||
wits: Set<string>; | ||
}, metadata: ReadonlyArray<TxMetadata>, auxiliaryData: WasmContract.AuxiliaryData | undefined, catalystRegistrationData: CatalystRegistrationData | undefined, stakingKey: WasmContract.PublicKey | undefined, valueInAccount: MultiTokenValue | undefined): Promise<WasmUnsignedTx>; | ||
}, 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, stakingKeyWits: Set<string>, extraMetadata: TxMetadata[]): Promise<SignedTx>; | ||
@@ -134,2 +134,2 @@ private addWitnesses; | ||
wits: Set<string>; | ||
}, metadata: ReadonlyArray<TxMetadata>, auxiliaryData: WasmContract.AuxiliaryData | undefined, catalystRegistrationData: CatalystRegistrationData | undefined, stakingKey: WasmContract.PublicKey | undefined, valueInAccount: MultiTokenValue | undefined): Promise<WasmUnsignedTx>; | ||
}, metadata: ReadonlyArray<TxMetadata>, auxiliaryData: WasmContract.AuxiliaryData | undefined, catalystRegistrationData: CatalystRegistrationData | undefined, stakingKey: WasmContract.PublicKey | undefined, valueInAccount: MultiTokenValue | undefined, withdrawalRequests: Array<WithdrawalRequest>): Promise<WasmUnsignedTx>; |
@@ -121,3 +121,3 @@ "use strict"; | ||
} | ||
static new(wasm, networkId, defaultToken, txBuilder, senderUtxos, allUtxos, inputs, totalInput, outputs, totalOutput, fee, change, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount) { | ||
static new(wasm, networkId, defaultToken, txBuilder, senderUtxos, allUtxos, inputs, totalInput, outputs, totalOutput, fee, change, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount, withdrawalRequests) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -178,2 +178,8 @@ const txBody = yield txBuilder.build(); | ||
} | ||
for (const withdrawalRequest of withdrawalRequests) { | ||
if (withdrawalRequest.stakingPrivateKey) { | ||
const vkeyWitness = yield wasm.makeVkeyWitness(yield wasm.hashTransaction(txBody), withdrawalRequest.stakingPrivateKey); | ||
neededStakingKeyHashes.wits.add(Buffer.from(yield vkeyWitness.toBytes()).toString('hex')); | ||
} | ||
} | ||
return new WasmUnsignedTx(wasm, txBody, txBuilder, senderUtxos, inputs, totalInput, outputs, totalOutput, fee, change, metadata, certs, withdrawals, deregistrations, delegations, registrations, ttl, neededStakingKeyHashes, Buffer.from(txBytes).toString('hex'), hash, auxiliaryData, catalystRegistrationData, totalAmountToDelegate); | ||
@@ -281,5 +287,5 @@ }); | ||
exports.WasmUnsignedTx = WasmUnsignedTx; | ||
function genWasmUnsignedTx(wasm, defaultToken, txBuilder, senderUtxos, allUtxos, change, defaults, networkId, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount) { | ||
function genWasmUnsignedTx(wasm, defaultToken, txBuilder, senderUtxos, allUtxos, change, defaults, networkId, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount, withdrawalRequests) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield WasmUnsignedTx.new(wasm, networkId, defaultToken, txBuilder, senderUtxos, allUtxos, yield genWasmUnsignedTxInputs(txBuilder, senderUtxos, networkId), yield genWasmUnsignedTxTotalInput(txBuilder, change, defaults), yield genWasmUnsignedTxOutputs(txBuilder, networkId), yield genWasmUnsignedTxTotalOutput(txBuilder, defaults), yield genWasmUnsignedTxFee(txBuilder, defaults, networkId), change, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount); | ||
return yield WasmUnsignedTx.new(wasm, networkId, defaultToken, txBuilder, senderUtxos, allUtxos, yield genWasmUnsignedTxInputs(txBuilder, senderUtxos, networkId), yield genWasmUnsignedTxTotalInput(txBuilder, change, defaults), yield genWasmUnsignedTxOutputs(txBuilder, networkId), yield genWasmUnsignedTxTotalOutput(txBuilder, defaults), yield genWasmUnsignedTxFee(txBuilder, defaults, networkId), change, neededStakingKeyHashes, metadata, auxiliaryData, catalystRegistrationData, stakingKey, valueInAccount, withdrawalRequests); | ||
}); | ||
@@ -286,0 +292,0 @@ } |
{ | ||
"name": "@emurgo/yoroi-lib-core", | ||
"version": "0.7.5-alpha.40", | ||
"version": "0.7.6-alpha.41", | ||
"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
290222
5122