Skip to content

Commit

Permalink
feat(wip): Add payment/deposit support to the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
bojidar-bg committed Dec 12, 2024
1 parent 32d3394 commit 1602763
Show file tree
Hide file tree
Showing 16 changed files with 752 additions and 208 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-promise": "^6.1.1",
"typescript": "^5.3.2"
}
},
"packageManager": "pnpm@9.12.2"
}
269 changes: 269 additions & 0 deletions pkg/abi-ts/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,3 +531,272 @@ export const paymentAbi = [
name: 'SafeERC20FailedOperation'
}
] as const

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PaymentV2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

export const paymentV2Abi = [
{
type: 'constructor',
inputs: [
{ name: '_token', internalType: 'contract IERC20', type: 'address' },
{ name: '_unlockTime', internalType: 'uint256', type: 'uint256' }
],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [
{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' },
{ name: 'recipient', internalType: 'address', type: 'address' },
{ name: 'permissions', internalType: 'uint16', type: 'uint16' },
{ name: 'reservedAmount', internalType: 'uint256', type: 'uint256' },
{ name: 'extraLimit', internalType: 'uint256', type: 'uint256' }
],
name: 'authorize',
outputs: [],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [
{ name: '', internalType: 'bytes32', type: 'bytes32' },
{ name: '', internalType: 'address', type: 'address' }
],
name: 'channelAuthorizations',
outputs: [
{ name: 'reservation', internalType: 'uint128', type: 'uint128' },
{ name: 'limit', internalType: 'uint128', type: 'uint128' },
{ name: 'unlocksAt', internalType: 'uint240', type: 'uint240' },
{ name: 'permissions', internalType: 'uint16', type: 'uint16' }
],
stateMutability: 'view'
},
{
type: 'function',
inputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
name: 'channels',
outputs: [
{ name: 'available', internalType: 'uint128', type: 'uint128' },
{ name: 'reserved', internalType: 'uint128', type: 'uint128' }
],
stateMutability: 'view'
},
{
type: 'function',
inputs: [
{
name: 'channelDiscriminator',
internalType: 'bytes32',
type: 'bytes32'
},
{ name: 'initialAmount', internalType: 'uint256', type: 'uint256' }
],
name: 'create',
outputs: [{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' }],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [
{
name: 'channelDiscriminator',
internalType: 'bytes32',
type: 'bytes32'
},
{ name: 'initialAmount', internalType: 'uint256', type: 'uint256' },
{ name: 'recipient', internalType: 'address', type: 'address' },
{ name: 'permissions', internalType: 'uint16', type: 'uint16' },
{ name: 'reservedAmount', internalType: 'uint256', type: 'uint256' },
{ name: 'limit', internalType: 'uint256', type: 'uint256' }
],
name: 'createAndAuthorize',
outputs: [],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [
{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' },
{ name: 'amount', internalType: 'uint256', type: 'uint256' }
],
name: 'deposit',
outputs: [],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [
{ name: 'creator', internalType: 'address', type: 'address' },
{ name: 'channelDiscriminator', internalType: 'bytes32', type: 'bytes32' }
],
name: 'getChannelId',
outputs: [{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' }],
stateMutability: 'pure'
},
{
type: 'function',
inputs: [],
name: 'token',
outputs: [{ name: '', internalType: 'contract IERC20', type: 'address' }],
stateMutability: 'view'
},
{
type: 'function',
inputs: [
{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' },
{ name: 'recipient', internalType: 'address', type: 'address' }
],
name: 'unlock',
outputs: [],
stateMutability: 'nonpayable'
},
{
type: 'function',
inputs: [],
name: 'unlockTime',
outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
stateMutability: 'view'
},
{
type: 'function',
inputs: [
{ name: 'channelId', internalType: 'bytes32', type: 'bytes32' },
{ name: 'transferAddress', internalType: 'address', type: 'address' },
{ name: 'transferAmount', internalType: 'uint256', type: 'uint256' }
],
name: 'withdraw',
outputs: [],
stateMutability: 'nonpayable'
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'channelId',
internalType: 'bytes32',
type: 'bytes32',
indexed: true
},
{
name: 'recipient',
internalType: 'address',
type: 'address',
indexed: true
},
{
name: 'permissions',
internalType: 'uint16',
type: 'uint16',
indexed: false
},
{
name: 'reservedAmount',
internalType: 'uint256',
type: 'uint256',
indexed: false
},
{
name: 'limit',
internalType: 'uint256',
type: 'uint256',
indexed: false
}
],
name: 'Authorize'
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'channelId',
internalType: 'bytes32',
type: 'bytes32',
indexed: true
},
{
name: 'payer',
internalType: 'address',
type: 'address',
indexed: true
},
{
name: 'amount',
internalType: 'uint256',
type: 'uint256',
indexed: false
}
],
name: 'Deposit'
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'channelId',
internalType: 'bytes32',
type: 'bytes32',
indexed: true
},
{
name: 'recipient',
internalType: 'address',
type: 'address',
indexed: true
}
],
name: 'Unlock'
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'channelId',
internalType: 'bytes32',
type: 'bytes32',
indexed: true
},
{
name: 'recipient',
internalType: 'address',
type: 'address',
indexed: true
},
{
name: 'amount',
internalType: 'uint256',
type: 'uint256',
indexed: false
}
],
name: 'Withdraw'
},
{
type: 'error',
inputs: [{ name: 'target', internalType: 'address', type: 'address' }],
name: 'AddressEmptyCode'
},
{ type: 'error', inputs: [], name: 'AlreadyInitialized' },
{ type: 'error', inputs: [], name: 'AuthorizationLocked' },
{ type: 'error', inputs: [], name: 'FailedCall' },
{
type: 'error',
inputs: [
{ name: 'balance', internalType: 'uint256', type: 'uint256' },
{ name: 'needed', internalType: 'uint256', type: 'uint256' }
],
name: 'InsufficientBalance'
},
{ type: 'error', inputs: [], name: 'InsufficientFunds' },
{ type: 'error', inputs: [], name: 'NotAuthorized' },
{
type: 'error',
inputs: [{ name: 'token', internalType: 'address', type: 'address' }],
name: 'SafeERC20FailedOperation'
}
] as const
6 changes: 5 additions & 1 deletion pkg/abi-ts/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export default defineConfig({
forge: {
build: false
},
include: ['Payment.json', 'MockToken.json']
include: [
'Payment.json',
'MockToken.json',
'PaymentV2.json',
]
})
]
})
Loading

0 comments on commit 1602763

Please sign in to comment.