Skip to content

Commit

Permalink
fix(signer): check if method is property of signer before using
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus committed May 24, 2024
1 parent b775c96 commit c52783c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/common/contracts/warp-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ArconnectSigner } from 'arbundles';
import {
Contract,
CustomSignature,
Expand Down Expand Up @@ -82,9 +81,8 @@ export class WarpContract<T>
// TODO: could abstract into our own interface that constructs different signers
async createWarpSigner(signer: ContractSigner): Promise<CustomSignature> {
// ensure appropriate permissions are granted with injected signers.
if (signer.publicKey === undefined) {
// ArweaveSigner will always have a public key - for some reason runtime cannot read the ArconnectSigner type, so we assume if no public key is present, it is an ArconnectSigner
await (signer as ArconnectSigner).setPublicKey();
if (signer.publicKey === undefined && 'setPublicKey' in signer) {
await signer.setPublicKey();
}
const warpSigner = new Signature(this.warp, {
signer: async (tx: Transaction) => {
Expand Down

0 comments on commit c52783c

Please sign in to comment.