@anywalletkit/wallet-zcash 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1096,7 +1096,7 @@ var WalletAccountZcash = class _WalletAccountZcash extends WalletAccountReadOnly
1096
1096
  tx.inputs[i].scriptSig = p2pkhScriptSig(der, this.publicKey);
1097
1097
  }
1098
1098
  }
1099
- async buildSignedTransaction(spend) {
1099
+ async signSpend(spend) {
1100
1100
  this.live();
1101
1101
  const plan = await this.planSpend(spend);
1102
1102
  const params = await this.chainParams();
@@ -1140,13 +1140,17 @@ var WalletAccountZcash = class _WalletAccountZcash extends WalletAccountReadOnly
1140
1140
  /** "What you sign": the fully resolved spend (signed, NOT broadcast) or a caller's raw hex. */
1141
1141
  async describeTransaction(tx) {
1142
1142
  if (typeof tx === "string") return (await this.describeRaw(tx)).desc;
1143
- return (await this.buildSignedTransaction(tx)).desc;
1143
+ return (await this.signSpend(tx)).desc;
1144
1144
  }
1145
- /** Sign without broadcasting. Returns the raw transaction hex. Raw hex input is returned unchanged. */
1145
+ /** Sign without broadcasting. Returns the raw transaction hex. Raw hex input gets the checks `sendTransaction` runs (prevouts through the client) and is returned unchanged, never re-signed. */
1146
1146
  async signTransaction(tx, options = {}) {
1147
1147
  this.live();
1148
- if (typeof tx === "string") return tx;
1149
- const built = await this.buildSignedTransaction(tx);
1148
+ if (typeof tx === "string") {
1149
+ const { desc } = await this.describeRaw(tx);
1150
+ this.checkMax(desc.fee, (0, import_core7.feeLimit)(this._config.transactionMaxFee, options), "transaction");
1151
+ return tx;
1152
+ }
1153
+ const built = await this.signSpend(tx);
1150
1154
  this.checkMax(built.fee, (0, import_core7.feeLimit)(this._config.transactionMaxFee, options), "transaction");
1151
1155
  return built.hex;
1152
1156
  }
@@ -1164,7 +1168,7 @@ var WalletAccountZcash = class _WalletAccountZcash extends WalletAccountReadOnly
1164
1168
  hash = txid(parsed);
1165
1169
  fee = desc.fee;
1166
1170
  } else {
1167
- const built = await this.buildSignedTransaction(tx);
1171
+ const built = await this.signSpend(tx);
1168
1172
  rawHex = built.hex;
1169
1173
  hash = built.txid;
1170
1174
  fee = built.fee;
@@ -1178,7 +1182,7 @@ var WalletAccountZcash = class _WalletAccountZcash extends WalletAccountReadOnly
1178
1182
  if (o.token) throw new Error("Tokens are not supported on the zcash blockchain.");
1179
1183
  this.live();
1180
1184
  const client = this.requireClient("transfer");
1181
- const built = await this.buildSignedTransaction({ to: o.recipient, value: o.amount });
1185
+ const built = await this.signSpend({ to: o.recipient, value: o.amount });
1182
1186
  this.checkMax(built.fee, (0, import_core7.feeLimit)(this._config.transferMaxFee, writeOptions), "transfer");
1183
1187
  const id = await client.broadcast(built.hex);
1184
1188
  return { hash: id || built.txid, fee: built.fee };