addSigner method
Future<CrossmintWalletAddSignerResult>
addSigner({
- required String walletId,
- required CrossmintSignerConfig signer,
- bool prepareOnly = false,
- bool deployImmediately = true,
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.
Implementation
@override
Future<CrossmintWalletAddSignerResult> addSigner({
required String walletId,
required CrossmintSignerConfig signer,
bool prepareOnly = false,
bool deployImmediately = true,
}) async {
final String resolvedChain = await _resolveWalletChainForSignerRegistration(
walletId,
);
final CrossmintJsonMap response = await _service.registerSigner(
walletId,
_codec.serializeSignerRegistrationRequest(
signer,
chain: resolvedChain,
deployImmediately: deployImmediately,
),
);
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,
);
}