addSigner method
Future<CrossmintWalletAddSignerResult>
addSigner({
- required String walletId,
- required CrossmintSignerConfig signer,
- bool prepareOnly = false,
- bool deployImmediately = true,
- String? approver,
override
Registers a new signer on the wallet.
On EVM wallets deployImmediately controls how the backend registers
the signer: true (the default) returns an on-chain registration
transaction that is installed immediately, false keeps the lazy
signature-request flow. The flag is never sent for Solana or Stellar
wallets.
approver names which recovery method authorizes this operation. It is
required by the backend when the wallet holds more than one recovery
method, and must be omitted otherwise.
Implementation
@override
Future<CrossmintWalletAddSignerResult> addSigner({
required String walletId,
required CrossmintSignerConfig signer,
bool prepareOnly = false,
bool deployImmediately = true,
String? approver,
}) async {
final String resolvedChain = await _resolveWalletChainForSignerRegistration(
walletId,
);
final CrossmintJsonMap response = await _service.registerSigner(
walletId,
_codec.serializeSignerRegistrationRequest(
signer,
chain: resolvedChain,
deployImmediately: deployImmediately,
approver: approver,
),
);
final CrossmintWalletSigner? signerState = _responseParser
.walletSignerFromMap(response, chain: resolvedChain);
if (signerState == null) {
throw CrossmintWalletException(
'Wallet signer registration did not return signer state for chain "$resolvedChain".',
cause: response,
);
}
return CrossmintWalletAddSignerResult(
signer: signerState,
signatureId: prepareOnly
? _responseParser.signatureIdFromSignerRegistration(
response,
chain: resolvedChain,
)
: null,
transactionId: prepareOnly
? _responseParser.transactionIdFromSignerRegistration(
response,
chain: resolvedChain,
)
: null,
raw: response,
);
}