Add sendAll hook for the anchor provider (#13)
This commit is contained in:
parent
7de26316a7
commit
fa5cde5c1e
|
@ -7,7 +7,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-async-hook": "^3.6.2",
|
"react-async-hook": "^3.6.2",
|
||||||
"@project-serum/serum": "^0.13.34",
|
"@project-serum/serum": "^0.13.34",
|
||||||
"@project-serum/swap": "^0.1.0-alpha.11",
|
"@project-serum/swap": "^0.1.0-alpha.12",
|
||||||
"@solana/spl-token": "^0.1.4"
|
"@solana/spl-token": "^0.1.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
16
src/App.tsx
16
src/App.tsx
|
@ -154,6 +154,22 @@ class NotifyingProvider extends Provider {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sendAll(
|
||||||
|
txs: Array<{ tx: Transaction; signers: Array<Account | undefined> }>,
|
||||||
|
opts?: ConfirmOptions
|
||||||
|
): Promise<Array<TransactionSignature>> {
|
||||||
|
try {
|
||||||
|
const txSigs = await super.sendAll(txs, opts);
|
||||||
|
txSigs.forEach((sig) => {
|
||||||
|
this.onTransaction(sig);
|
||||||
|
});
|
||||||
|
return txSigs;
|
||||||
|
} catch (err) {
|
||||||
|
this.onTransaction(undefined, err);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
|
@ -1588,10 +1588,10 @@
|
||||||
bs58 "^4.0.1"
|
bs58 "^4.0.1"
|
||||||
eventemitter3 "^4.0.4"
|
eventemitter3 "^4.0.4"
|
||||||
|
|
||||||
"@project-serum/swap@^0.1.0-alpha.11":
|
"@project-serum/swap@^0.1.0-alpha.12":
|
||||||
version "0.1.0-alpha.11"
|
version "0.1.0-alpha.12"
|
||||||
resolved "https://registry.yarnpkg.com/@project-serum/swap/-/swap-0.1.0-alpha.11.tgz#65c6393bdc511208453c853095eba32e0748191b"
|
resolved "https://registry.yarnpkg.com/@project-serum/swap/-/swap-0.1.0-alpha.12.tgz#085055c1bbed66d8e9a9f8da9e23d2315ad09181"
|
||||||
integrity sha512-cxjxweWrZWcxfazkxSjDXqLquKlCCOoJ7z+cfAky/l29gRet+rLbGjyd+TAcZRDrIfh+kut9svPlL/bXK9vIOw==
|
integrity sha512-iIFBbwkIVAJaUPx3Wn240gba6tpAtBHHfcEbInz+O+enCUUHCCIi96SY1R6nBHKNWiH2qY+nlPfXR62Lra/cyw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@project-serum/anchor" "^0.5.1-beta.2"
|
"@project-serum/anchor" "^0.5.1-beta.2"
|
||||||
"@project-serum/serum" "^0.13.34"
|
"@project-serum/serum" "^0.13.34"
|
||||||
|
|
Loading…
Reference in New Issue