Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add signInMulti method #811

Open
wants to merge 35 commits into
base: dev
Choose a base branch
from
Open
Changes from 4 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
264f904
Added interfaces for signInMulti in wallet types.
kujtimprenkuSQA May 19, 2023
627d59b
Add signInMulti method to each wallet.
kujtimprenkuSQA May 19, 2023
142ecb3
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA May 19, 2023
d40159a
Fix jsdoc warnings and improved docs.
kujtimprenkuSQA May 19, 2023
35448f4
Added logic to allow sign-in with multiple contracts.
kujtimprenkuSQA May 22, 2023
60ac5a0
Fix build for here wallet.
kujtimprenkuSQA May 22, 2023
6e3d5f3
Added contracts to ModalOptions interface.
kujtimprenkuSQA May 23, 2023
512f12b
Added logic to handle signInMulti in modal-ui and modal-ui-js.
kujtimprenkuSQA May 23, 2023
fb519ea
Added docs for .
kujtimprenkuSQA May 23, 2023
5f6bfd4
Fix docs since permissions is required for signInMulti.
kujtimprenkuSQA May 23, 2023
da54351
Remove contracts from setupModal in angular example.
kujtimprenkuSQA May 23, 2023
72b83e5
Export MultiContractState interface.
kujtimprenkuSQA May 23, 2023
8121e5e
Removed signInMulti from inside the modules instead throw when decora…
kujtimprenkuSQA Jun 27, 2023
f910c39
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA Jun 27, 2023
8d0d967
Removed contractId and added made contracts required, signAndSendTran…
amirsaran3 Jul 3, 2023
2f559f7
Added method to update old contract state for signed in users
amirsaran3 Jul 5, 2023
1188905
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA Jul 20, 2023
668d7a4
Trigger signInMulti for ledger when there are multiple contracts.
kujtimprenkuSQA Jul 21, 2023
47bedc6
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA Jul 24, 2023
970b9d1
Merge branch 'SQC-540/add-signin-multi' into SQC-540/add-signin-multi…
kujtimprenkuSQA Jul 24, 2023
9c487aa
Merge branch 'SQC-540/add-signin-multi' of https://github.com/near/wa…
kujtimprenkuSQA Sep 18, 2023
8433139
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA Sep 18, 2023
9448d81
Merge branch 'SQC-540/add-signin-multi' into SQC-540/add-signin-multi…
kujtimprenkuSQA Sep 18, 2023
45da765
Merge branch 'dev' into SQC-540/add-signin-multi
kujtimprenkuSQA Feb 6, 2024
6c1e65c
Merge branch 'SQC-540/add-signin-multi' into SQC-540/add-signin-multi…
kujtimprenkuSQA Feb 6, 2024
f7bd15e
fix near-mobile-wallet, near-snap and ramper-wallet methods
gtsonevv Jul 24, 2024
1ff90b8
fix if check
gtsonevv Jul 24, 2024
142c447
update receiverId value
gtsonevv Jul 25, 2024
565665d
Merge pull request #1138 from near/SQC-540/add-signin-multi-breaking-…
gtsonevv Jul 25, 2024
f39d4b3
Update signedIn emit data; Fix resolveStorageState logic
gtsonevv Jul 29, 2024
7cf58bb
Update docs
gtsonevv Jul 30, 2024
ff6d042
Merge pull request #847 from near/SQC-540/add-signin-multi-breaking-c…
gtsonevv Aug 2, 2024
422d9fb
Merge branch 'dev' into SQC-540/add-signin-multi
gtsonevv Aug 2, 2024
aa0db8a
Fix merge issues
gtsonevv Aug 2, 2024
180f5b8
Fix modal errors
gtsonevv Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/near-mobile-wallet/src/lib/init.wallet.ts
Original file line number Diff line number Diff line change
@@ -55,13 +55,13 @@ export const initNearMobileWallet: NearMobileWalletInit = async (config) => {
async signAndSendTransaction(data) {
logger.log("[NearMobileWallet]: signAndSendTransaction", data);

const { contract } = store.getState();
if (!contract) {
const { contracts } = store.getState();
if (contracts.length < 1) {
throw new Error("Wallet not signed in");
}

return await nearMobileWallet.signAndSendTransaction({
receiverId: contract.contractId,
receiverId: data.receiverId,
...data,
});
},
8 changes: 4 additions & 4 deletions packages/near-snap/src/lib/selector.ts
Original file line number Diff line number Diff line change
@@ -44,19 +44,19 @@ export const initNearSnap: WalletBehaviourFactory<InjectedWallet> = async (

async signAndSendTransaction(data) {
logger.log("NearSnap:signAndSendTransaction", data);
const { contracts } = store.getState();

if (account == null) {
if (account === null || contracts.length < 1) {
throw new Error("Wallet not signed in");
}

const { contract } = store.getState();
const receiverId = data.receiverId ?? contract?.contractId;
const receiverId = data.receiverId;

if (receiverId == null) {
throw new Error("ReceiverId is not defined");
}

return await account.executeTransaction({ receiverId, ...data });
return await account.executeTransaction({ ...data, receiverId });
},

async signMessage({ message, nonce, recipient }) {
10 changes: 5 additions & 5 deletions packages/ramper-wallet/src/lib/ramper-wallet.ts
Original file line number Diff line number Diff line change
@@ -73,9 +73,9 @@ const RamperWallet: WalletBehaviourFactory<InjectedWallet> = async ({
transactions: Array<Optional<Transaction, "signerId">>
) => {
const accounts = await getAccounts();
const { contract } = store.getState();
const { contracts } = store.getState();

if (!accounts.length || !contract) {
if (!accounts.length || contracts.length < 1) {
throw new Error("Wallet not signed in");
}

@@ -85,7 +85,7 @@ const RamperWallet: WalletBehaviourFactory<InjectedWallet> = async ({
);

return {
receiverId: transaction.receiverId || contract.contractId,
receiverId: transaction.receiverId,
actions: parsedActions,
};
});
@@ -127,10 +127,10 @@ const RamperWallet: WalletBehaviourFactory<InjectedWallet> = async ({
}: Omit<Transaction, "signerId">) {
logger.log("signAndSendTransaction", { receiverId, actions });

const { contract } = store.getState();
const { contracts } = store.getState();
const accounts = await getAccounts();

if (!accounts.length || !contract) {
if (!accounts.length || contracts.length < 1) {
throw new Error("Wallet not signed in");
}