Skip to content

Commit 8c9037b

Browse files
feat: update keyreg examples
1 parent 47da6ef commit 8c9037b

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

projects/python-examples/algokit_utils_py_examples/transactions/transaction_types.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ def transaction_types() -> None:
388388
)
389389
# example: APPLICATION_CLEAR_STATE_TRANSACTION
390390

391-
# example: KEY_REGISTRATION_TRANSACTION
392-
391+
# example: KEY_REGISTRATION_ONLINE_TRANSACTION
393392
"""
394393
Create an unsigned online key registration transaction
395394
@@ -413,7 +412,9 @@ def transaction_types() -> None:
413412
)
414413
)
415414
)
415+
# example: KEY_REGISTRATION_ONLINE_TRANSACTION
416416

417+
# example: KEY_REGISTRATION_OFFLINE_TRANSACTION
417418
"""
418419
Create an unsigned offline key registration transaction
419420
@@ -429,8 +430,7 @@ def transaction_types() -> None:
429430
)
430431
)
431432
)
432-
433-
# example: KEY_REGISTRATION_TRANSACTION
433+
# example: KEY_REGISTRATION_OFFLINE_TRANSACTION
434434

435435

436436
transaction_types()

projects/typescript-examples/algokit-utils-ts/transactions/transacton-types.ts

+30-11
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,41 @@ applicationTransactionTypes()
162162
async function keyRegistrationTransactionTypes() {
163163
const { algorand, randomAccountA } = await setupLocalnetEnvironment()
164164

165-
// example: KEY_REG_ONLINE_TRANSACTION
165+
// example: KEY_REGISTRATION_ONLINE_TRANSACTION
166+
/**
167+
* Create an unsigned online key registration transaction
168+
*
169+
* Parameters for online key registration.
170+
* - sender: The address of the account that will send the transaction
171+
* - voteKey: The root participation public key
172+
* - selectionKey: The VRF public key
173+
* - voteFirst: The first round that the participation key is valid. Not to be confused with the firstValid round of the keyreg transaction
174+
* - voteLast: The last round that the participation key is valid. Not to be confused with the lastValid round of the keyreg transaction
175+
* - voteKeyDilution: This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys
176+
*/
166177
await algorand.createTransaction.onlineKeyRegistration({
167-
sender: randomAccountA, // The address of the account sending the transaction
168-
voteKey: new Uint8Array(), // The root participation public key
169-
selectionKey: new Uint8Array(), // The VRF public key
170-
voteFirst: 1000n, // The first round that the participation key is valid. Not to be confused with the firstValid round of the keyreg transaction
171-
voteLast: 2000n, // The last round that the participation key is valid. Not to be confused with the lastValid round of the keyreg transaction
172-
voteKeyDilution: 10n, // This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys
178+
sender: randomAccountA,
179+
voteKey: new Uint8Array(),
180+
selectionKey: new Uint8Array(),
181+
voteFirst: 1000n,
182+
voteLast: 2000n,
183+
voteKeyDilution: 10n,
173184
})
174-
// example: KEY_REG_ONLINE_TRANSACTION
185+
// example: KEY_REGISTRATION_ONLINE_TRANSACTION
175186

176-
// example: KEY_REG_OFFLINE_TRANSACTION
187+
// example: KEY_REGISTRATION_OFFLINE_TRANSACTION
188+
/**
189+
* Create an unsigned offline key registration transaction
190+
*
191+
* Parameters for offline key registration.
192+
* - sender: The address of the account that will send the transaction
193+
* - preventAccountFromEverParticipatingAgain: Whether to prevent the account from ever participating again
194+
*/
177195
await algorand.createTransaction.offlineKeyRegistration({
178-
sender: randomAccountA, // The address of the account sending the transaction
196+
sender: randomAccountA,
197+
preventAccountFromEverParticipatingAgain: false,
179198
})
180-
// example: KEY_REG_OFFLINE_TRANSACTION
199+
// example: KEY_REGISTRATION_OFFLINE_TRANSACTION
181200
}
182201

183202
keyRegistrationTransactionTypes()

0 commit comments

Comments
 (0)