Private/Set-PolymarketApproval.ps1
|
function Set-PolymarketApproval { [CmdletBinding(SupportsShouldProcess)] param ( [Parameter(Mandatory = $true)] [string]$Token, [Parameter(Mandatory = $true)] [string]$Spender, [Parameter()] [string]$Amount = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' ) process { if ($PSCmdlet.ShouldProcess("Token $Token", "Approve $Spender to spend $Amount")) { $tx = [Polymarket]::Erc20ApprovalTransaction($Token, $Spender, $Amount) Write-Host "Transaction created for approval of $Spender on $Token" -ForegroundColor Cyan return $tx } } } |