# convert balance to shares using the ``convert_to_shares`` functionkeypair = Keypair.create_from_uri('//Alice')# replace with your mnemonic phrasecall = substrate.compose_call( call_module='Network', call_function='transfer_delegate_stake', call_params={'from_subnet_id': from_subnet_id,'to_subnet_id': to_subnet_id,'shares_to_be_switched': shares_to_be_switched, })extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
// convert balance to shares using the ``convert_to_shares`` functionconstapi=awaitApiPromise.create();// Construct the keyring after the API (crypto has an async init)constkeyring=newKeyring({ type:'sr25519' });// Replace //Alice with your mnemonic phraseconstkeypair=keyring.addFromUri('//Alice');constfromSubnetId=1;consttoSubnetId=2;constsharesToBeSwitched=100;constextrinsic=api.tx.network.transferDelegateStake( fromSubnetId, toSubnetId, sharesToBeSwitched);consthash=awaitextrinsic.signAndSend(keypair);