Skip to content

Commit 902c089

Browse files
authored
Merge pull request #721 from EdgeApp/sam/memory-wallet-other-methods
fix(memory-wallet): expose plugin otherMethods on memory wallets
2 parents 26499af + 002bcc9 commit 902c089

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- added: Expose engine otherMethods on EdgeMemoryWallet so memory wallets support custom methods like makeMaxSpend.
6+
57
## 2.43.6 (2026-04-02)
68

79
- fixed: Upgraded @nymproject/mix-fetch with promised reliability improvements.

src/core/account/memory-wallet.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ export const makeMemoryWalletInner = async (
147147
syncNetworkTask.start({ wait: false })
148148
}
149149

150+
const otherMethods: { [name: string]: (...args: any[]) => any } = {}
151+
if (engine.otherMethods != null) {
152+
for (const name of Object.keys(engine.otherMethods)) {
153+
const method = engine.otherMethods[name]
154+
if (typeof method !== 'function') continue
155+
otherMethods[name] = method
156+
}
157+
}
158+
if (engine.otherMethodsWithKeys != null) {
159+
for (const name of Object.keys(engine.otherMethodsWithKeys)) {
160+
const method = engine.otherMethodsWithKeys[name]
161+
if (typeof method !== 'function') continue
162+
otherMethods[name] = (...args: any[]) => method(walletInfo.keys, ...args)
163+
}
164+
}
165+
bridgifyObject(otherMethods)
166+
150167
const out = bridgifyObject<EdgeMemoryWallet>({
151168
watch: watchMethod,
152169
get balanceMap() {
@@ -196,6 +213,8 @@ export const makeMemoryWalletInner = async (
196213
},
197214
async saveTx() {},
198215

216+
otherMethods,
217+
199218
async close() {
200219
log.warn('killing memory wallet')
201220
syncNetworkTask?.stop()

src/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,7 @@ export interface EdgeMemoryWallet {
14731473
readonly signTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>
14741474
readonly broadcastTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>
14751475
readonly saveTx: (tx: EdgeTransaction) => Promise<void>
1476+
readonly otherMethods: EdgeOtherMethods
14761477
readonly close: () => Promise<void>
14771478

14781479
/** @deprecated Use syncStatus */

0 commit comments

Comments
 (0)