Skip to content

Conversation

@MantisClone
Copy link
Member

@MantisClone MantisClone commented Dec 19, 2024

Fixes #11

Problem

Paygrid said they couldn't get delegate declarative payments working.

Proposed Solution

Add a script that exercises the delegate declarative payments.

Changes

  • Add the delegateDeclarePaymentSentAndReceived.js script in which:
    • The Payee creates a request to the Payer
    • The Payee delegates to the Payee Delegate
    • The Payer delegates to the Payer Delegate
    • The Payer Delegate declares sent payment
    • The Payee Delegate declares received payment
    • The request balance is updated

Output

Example Output

npm run delegate

> [email protected] delegate
> node src/delegateDeclarePaymentSentAndReceived.js

payeeRequestDataAfterDelegate: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "0",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null
      ]
    }
  },
  "pending": {
    "extensionsData": [
      {
        "action": "create",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "paymentNetworkName": "sepolia",
          "salt": "e6747951db35be58"
        },
        "version": "0.2.0"
      },
      {
        "action": "create",
        "id": "content-data",
        "parameters": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      },
      {
        "action": "addDelegate",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "delegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        }
      }
    ],
    "extensions": {
      "pn-erc20-fee-proxy-contract": {
        "events": [
          {
            "name": "create",
            "parameters": {
              "feeAddress": "0x0000000000000000000000000000000000000000",
              "feeAmount": "0",
              "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
              "salt": "e6747951db35be58"
            },
            "timestamp": 1734672036
          },
          {
            "name": "addDelegate",
            "parameters": {
              "delegate": {
                "type": "ethereumAddress",
                "value": "0x10795B103b244057Da500025a8EFA640872239a0"
              }
            },
            "timestamp": 1734672042,
            "from": {
              "type": "ethereumAddress",
              "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
            }
          }
        ],
        "id": "pn-erc20-fee-proxy-contract",
        "type": "payment-network",
        "values": {
          "salt": "e6747951db35be58",
          "receivedPaymentAmount": "0",
          "receivedRefundAmount": "0",
          "sentPaymentAmount": "0",
          "sentRefundAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "payeeDelegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        },
        "version": "0.2.0"
      },
      "content-data": {
        "events": [],
        "id": "content-data",
        "type": "content-data",
        "values": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      }
    },
    "events": [
      {
        "actionSigner": {
          "type": "ethereumAddress",
          "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
        },
        "name": "addExtensionsData",
        "parameters": {
          "extensionsDataLength": 1
        },
        "timestamp": 1734672042
      }
    ]
  }
}
payeeRequestDataAfterDelegateConfirmed: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "0",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null
      ]
    }
  },
  "pending": null
}
Observe that extensions.pn-erc20-fee-proxy-contract.values.payeeDelegate is set to the payee delegate identity
payerRequestDataAfterDelegate: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "0",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm",
          "QmUv8nByZDcWZ7rFxpTPPH8Qn1MGoRHSTWDL17HAU2PjHZ"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null,
        null
      ]
    }
  },
  "pending": {
    "extensionsData": [
      {
        "action": "create",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "paymentNetworkName": "sepolia",
          "salt": "e6747951db35be58"
        },
        "version": "0.2.0"
      },
      {
        "action": "create",
        "id": "content-data",
        "parameters": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      },
      {
        "action": "addDelegate",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "delegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        }
      },
      {
        "action": "addDelegate",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "delegate": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        }
      }
    ],
    "extensions": {
      "pn-erc20-fee-proxy-contract": {
        "events": [
          {
            "name": "create",
            "parameters": {
              "feeAddress": "0x0000000000000000000000000000000000000000",
              "feeAmount": "0",
              "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
              "salt": "e6747951db35be58"
            },
            "timestamp": 1734672036
          },
          {
            "name": "addDelegate",
            "parameters": {
              "delegate": {
                "type": "ethereumAddress",
                "value": "0x10795B103b244057Da500025a8EFA640872239a0"
              }
            },
            "timestamp": 1734672048,
            "from": {
              "type": "ethereumAddress",
              "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
            }
          },
          {
            "name": "addDelegate",
            "parameters": {
              "delegate": {
                "type": "ethereumAddress",
                "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
              }
            },
            "timestamp": 1734672052,
            "from": {
              "type": "ethereumAddress",
              "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
            }
          }
        ],
        "id": "pn-erc20-fee-proxy-contract",
        "type": "payment-network",
        "values": {
          "salt": "e6747951db35be58",
          "receivedPaymentAmount": "0",
          "receivedRefundAmount": "0",
          "sentPaymentAmount": "0",
          "sentRefundAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "payeeDelegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          },
          "payerDelegate": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        },
        "version": "0.2.0"
      },
      "content-data": {
        "events": [],
        "id": "content-data",
        "type": "content-data",
        "values": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      }
    },
    "events": [
      {
        "actionSigner": {
          "type": "ethereumAddress",
          "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
        },
        "name": "addExtensionsData",
        "parameters": {
          "extensionsDataLength": 1
        },
        "timestamp": 1734672052
      }
    ]
  }
}
payerRequestDataAfterDelegateConfirmed: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        }
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
            }
          },
          "timestamp": 1734672060,
          "from": {
            "type": "ethereumAddress",
            "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "0",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "payerDelegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        },
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672060
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm",
          "QmUv8nByZDcWZ7rFxpTPPH8Qn1MGoRHSTWDL17HAU2PjHZ"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 2,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315953,
              "blockTimestamp": 1734672060,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xc90c1885239636b85e5a14b034f425b3427db8ee28f5b0630df0166c49aaf0a0"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672060
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null,
        null
      ]
    }
  },
  "pending": null
}
Observe that extensions.pn-erc20-fee-proxy-contract.values.payerDelegate is set to the payer delegate identity
payerDelegateRequestDataAfterSent: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        }
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
            }
          },
          "timestamp": 1734672060,
          "from": {
            "type": "ethereumAddress",
            "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "0",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "payerDelegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        },
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672060
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm",
          "QmUv8nByZDcWZ7rFxpTPPH8Qn1MGoRHSTWDL17HAU2PjHZ",
          "QmPKJn1QUB2tHmeEBChNjxT1hQRcpTVmCF6A1LHqZx33Pr"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 2,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315953,
              "blockTimestamp": 1734672060,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xc90c1885239636b85e5a14b034f425b3427db8ee28f5b0630df0166c49aaf0a0"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672060
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null,
        null,
        null
      ]
    }
  },
  "pending": {
    "extensionsData": [
      {
        "action": "create",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "paymentNetworkName": "sepolia",
          "salt": "e6747951db35be58"
        },
        "version": "0.2.0"
      },
      {
        "action": "create",
        "id": "content-data",
        "parameters": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      },
      {
        "action": "addDelegate",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "delegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        }
      },
      {
        "action": "addDelegate",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "delegate": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        }
      },
      {
        "action": "declareSentPayment",
        "id": "pn-erc20-fee-proxy-contract",
        "parameters": {
          "amount": "1000000000000000000",
          "note": "payment initiated from the bank"
        }
      }
    ],
    "extensions": {
      "pn-erc20-fee-proxy-contract": {
        "events": [
          {
            "name": "create",
            "parameters": {
              "feeAddress": "0x0000000000000000000000000000000000000000",
              "feeAmount": "0",
              "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
              "salt": "e6747951db35be58"
            },
            "timestamp": 1734672036
          },
          {
            "name": "addDelegate",
            "parameters": {
              "delegate": {
                "type": "ethereumAddress",
                "value": "0x10795B103b244057Da500025a8EFA640872239a0"
              }
            },
            "timestamp": 1734672048,
            "from": {
              "type": "ethereumAddress",
              "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
            }
          },
          {
            "name": "addDelegate",
            "parameters": {
              "delegate": {
                "type": "ethereumAddress",
                "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
              }
            },
            "timestamp": 1734672060,
            "from": {
              "type": "ethereumAddress",
              "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
            }
          },
          {
            "name": "declareSentPayment",
            "parameters": {
              "amount": "1000000000000000000",
              "note": "payment initiated from the bank"
            },
            "timestamp": 1734672067,
            "from": {
              "type": "ethereumAddress",
              "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
            }
          }
        ],
        "id": "pn-erc20-fee-proxy-contract",
        "type": "payment-network",
        "values": {
          "salt": "e6747951db35be58",
          "receivedPaymentAmount": "0",
          "receivedRefundAmount": "0",
          "sentPaymentAmount": "1000000000000000000",
          "sentRefundAmount": "0",
          "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
          "feeAddress": "0x0000000000000000000000000000000000000000",
          "feeAmount": "0",
          "payeeDelegate": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          },
          "payerDelegate": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        },
        "version": "0.2.0"
      },
      "content-data": {
        "events": [],
        "id": "content-data",
        "type": "content-data",
        "values": {
          "content": {
            "reason": "🍕",
            "dueDate": "2023.06.16",
            "builderId": "request-network",
            "createdWith": "quickstart"
          }
        },
        "version": "0.1.0"
      }
    },
    "events": [
      {
        "actionSigner": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        },
        "name": "addExtensionsData",
        "parameters": {
          "extensionsDataLength": 1
        },
        "timestamp": 1734672067
      }
    ]
  }
}
payerDelegateRequestDataAfterSentConfirmed: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        }
      }
    },
    {
      "action": "declareSentPayment",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "amount": "1000000000000000000",
        "note": "payment initiated from the bank"
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
            }
          },
          "timestamp": 1734672060,
          "from": {
            "type": "ethereumAddress",
            "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
          }
        },
        {
          "name": "declareSentPayment",
          "parameters": {
            "amount": "1000000000000000000",
            "note": "payment initiated from the bank"
          },
          "timestamp": 1734672072,
          "from": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "0",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "1000000000000000000",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "payerDelegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        },
        "feeBalance": {
          "events": [],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672060
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672072
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "0",
    "events": [],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm",
          "QmUv8nByZDcWZ7rFxpTPPH8Qn1MGoRHSTWDL17HAU2PjHZ",
          "QmPKJn1QUB2tHmeEBChNjxT1hQRcpTVmCF6A1LHqZx33Pr"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 3,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 2,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          },
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315953,
              "blockTimestamp": 1734672060,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xc90c1885239636b85e5a14b034f425b3427db8ee28f5b0630df0166c49aaf0a0"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672060
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315954,
              "blockTimestamp": 1734672072,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xbe0bcb82666a4c302913d97b0521c875cf71a23a41c6ec2a65377e7faf564829"
            },
            "ipfs": {
              "size": 850
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672072
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null,
        null,
        null
      ]
    }
  },
  "pending": null
}
Observe extensionsData contains 5 events: paymentNetwork 'create', contentData 'create', paymentNetwork 'addDelegate' x2, and paymentNetwork 'declareSentPayment'
payeeDelegateRequestDataAfterReceivedConfirmed: {
  "_events": {},
  "_eventsCount": 0,
  "currency": "FAU-sepolia",
  "expectedAmount": "1000000000000000000",
  "payee": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "payer": {
    "type": "ethereumAddress",
    "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
  },
  "timestamp": 1734672029,
  "extensionsData": [
    {
      "action": "create",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "paymentNetworkName": "sepolia",
        "salt": "e6747951db35be58"
      },
      "version": "0.2.0"
    },
    {
      "action": "create",
      "id": "content-data",
      "parameters": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        }
      }
    },
    {
      "action": "addDelegate",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "delegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        }
      }
    },
    {
      "action": "declareSentPayment",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "amount": "1000000000000000000",
        "note": "payment initiated from the bank"
      }
    },
    {
      "action": "declareReceivedPayment",
      "id": "pn-erc20-fee-proxy-contract",
      "parameters": {
        "amount": "1000000000000000000",
        "note": "payment received from the bank"
      }
    }
  ],
  "extensions": {
    "pn-erc20-fee-proxy-contract": {
      "events": [
        {
          "name": "create",
          "parameters": {
            "feeAddress": "0x0000000000000000000000000000000000000000",
            "feeAmount": "0",
            "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
            "salt": "e6747951db35be58"
          },
          "timestamp": 1734672036
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0x10795B103b244057Da500025a8EFA640872239a0"
            }
          },
          "timestamp": 1734672048,
          "from": {
            "type": "ethereumAddress",
            "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
          }
        },
        {
          "name": "addDelegate",
          "parameters": {
            "delegate": {
              "type": "ethereumAddress",
              "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
            }
          },
          "timestamp": 1734672060,
          "from": {
            "type": "ethereumAddress",
            "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
          }
        },
        {
          "name": "declareSentPayment",
          "parameters": {
            "amount": "1000000000000000000",
            "note": "payment initiated from the bank"
          },
          "timestamp": 1734672072,
          "from": {
            "type": "ethereumAddress",
            "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
          }
        },
        {
          "name": "declareReceivedPayment",
          "parameters": {
            "amount": "1000000000000000000",
            "note": "payment received from the bank"
          },
          "timestamp": 1734672084,
          "from": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        }
      ],
      "id": "pn-erc20-fee-proxy-contract",
      "type": "payment-network",
      "values": {
        "salt": "e6747951db35be58",
        "receivedPaymentAmount": "1000000000000000000",
        "receivedRefundAmount": "0",
        "sentPaymentAmount": "1000000000000000000",
        "sentRefundAmount": "0",
        "paymentAddress": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567",
        "feeAddress": "0x0000000000000000000000000000000000000000",
        "feeAmount": "0",
        "payeeDelegate": {
          "type": "ethereumAddress",
          "value": "0x10795B103b244057Da500025a8EFA640872239a0"
        },
        "payerDelegate": {
          "type": "ethereumAddress",
          "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
        },
        "feeBalance": {
          "events": [
            {
              "amount": "1000000000000000000",
              "name": "payment",
              "parameters": {
                "note": "payment received from the bank",
                "from": {
                  "type": "ethereumAddress",
                  "value": "0x10795B103b244057Da500025a8EFA640872239a0"
                }
              },
              "timestamp": 1734672084
            }
          ],
          "balance": "0"
        }
      },
      "version": "0.2.0"
    },
    "content-data": {
      "events": [],
      "id": "content-data",
      "type": "content-data",
      "values": {
        "content": {
          "reason": "🍕",
          "dueDate": "2023.06.16",
          "builderId": "request-network",
          "createdWith": "quickstart"
        }
      },
      "version": "0.1.0"
    }
  },
  "requestId": "01598f9d6ff2711a23c25864e7cc4f9b662972c428934f4bee7337927115d68cc8",
  "version": "2.0.3",
  "events": [
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "create",
      "parameters": {
        "expectedAmount": "1000000000000000000",
        "extensionsDataLength": 2,
        "isSignedRequest": false
      },
      "timestamp": 1734672036
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672048
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x519145B771a6e450461af89980e5C17Ff6Fd8A92"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672060
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0xeC73874E97C98fC793E340325A4CaAEd312039C3"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672072
    },
    {
      "actionSigner": {
        "type": "ethereumAddress",
        "value": "0x10795B103b244057Da500025a8EFA640872239a0"
      },
      "name": "addExtensionsData",
      "parameters": {
        "extensionsDataLength": 1
      },
      "timestamp": 1734672084
    }
  ],
  "state": "created",
  "creator": {
    "type": "ethereumAddress",
    "value": "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567"
  },
  "balance": {
    "balance": "1000000000000000000",
    "events": [
      {
        "amount": "1000000000000000000",
        "name": "payment",
        "parameters": {
          "note": "payment received from the bank",
          "from": {
            "type": "ethereumAddress",
            "value": "0x10795B103b244057Da500025a8EFA640872239a0"
          }
        },
        "timestamp": 1734672084
      }
    ],
    "escrowEvents": []
  },
  "contentData": {
    "reason": "🍕",
    "dueDate": "2023.06.16",
    "builderId": "request-network",
    "createdWith": "quickstart"
  },
  "currencyInfo": {
    "type": "ERC20",
    "value": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
    "network": "sepolia"
  },
  "meta": {
    "ignoredTransactions": [],
    "transactionManagerMeta": {
      "dataAccessMeta": {
        "transactionsStorageLocation": [
          "QmVD326EYQ32dxM4QE2VscJ2CBZwkFDQYkZ4DMCXfXKZrW",
          "Qme8R9XhYdnFADBKpgqarkGjyYQ4XEvJcjteEMxU8wYVTm",
          "QmUv8nByZDcWZ7rFxpTPPH8Qn1MGoRHSTWDL17HAU2PjHZ",
          "QmPKJn1QUB2tHmeEBChNjxT1hQRcpTVmCF6A1LHqZx33Pr",
          "QmSFz39jUQHomrSKgRSNcWswyLzqJrVUdsGM2cHpk5kfak"
        ],
        "storageMeta": [
          {
            "ethereum": {
              "blockConfirmation": 4,
              "blockNumber": 7315951,
              "blockTimestamp": 1734672036,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x7fc396b5bd7cbbdbb047e8871e14dc7e9735e3efe90012d614699a84a44ee271"
            },
            "ipfs": {
              "size": 1627
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672036
          },
          {
            "ethereum": {
              "blockConfirmation": 3,
              "blockNumber": 7315952,
              "blockTimestamp": 1734672048,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0x8d92e2289e3b9606538ac7e563849ab80645cd6ec75c616ab892d9eed8ce517d"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672048
          },
          {
            "ethereum": {
              "blockConfirmation": 2,
              "blockNumber": 7315953,
              "blockTimestamp": 1734672060,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xc90c1885239636b85e5a14b034f425b3427db8ee28f5b0630df0166c49aaf0a0"
            },
            "ipfs": {
              "size": 864
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672060
          },
          {
            "ethereum": {
              "blockConfirmation": 1,
              "blockNumber": 7315954,
              "blockTimestamp": 1734672072,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xbe0bcb82666a4c302913d97b0521c875cf71a23a41c6ec2a65377e7faf564829"
            },
            "ipfs": {
              "size": 850
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672072
          },
          {
            "ethereum": {
              "blockConfirmation": 0,
              "blockNumber": 7315955,
              "blockTimestamp": 1734672084,
              "networkName": "sepolia",
              "smartContractAddress": "0xd6c085a4d14e9e171f4af58f7f48bd81173f167e",
              "transactionHash": "0xef7402f1f2cdd5db94e6ae71020999d3bf960f0b52b7abb33a5c443d593aedf2"
            },
            "ipfs": {
              "size": 853
            },
            "state": "confirmed",
            "storageType": "ethereumIpfs",
            "timestamp": 1734672084
          }
        ]
      },
      "ignoredTransactions": [
        null,
        null,
        null,
        null,
        null
      ]
    }
  },
  "pending": null
}
Observe extensionsData contains 6 events: paymentNetwork 'create', contentData 'create', paymentNetwork 'addDelegate' x2, paymentNetwork 'declareSentPayment', and paymentNetwork 'declareReceivedPayment'
Request balance: 1000000000000000000
Observe that the balance is 1000000000000000000
Request balance events: [
  {
    "amount": "1000000000000000000",
    "name": "payment",
    "parameters": {
      "note": "payment received from the bank",
      "from": {
        "type": "ethereumAddress",
        "value": "0x10795B103b244057Da500025a8EFA640872239a0"
      }
    },
    "timestamp": 1734672084
  }
]
Observe that the balance event note is "payment received from the bank"

Summary by CodeRabbit

  • New Features

    • Added a new script command npm run delegate for executing payment-related operations.
    • Introduced functionality for declaring payments sent and received between delegates.
  • Documentation

    • Updated README.md to include the new command in the "Run" section.
    • Added new environment variables PAYEE_DELEGATE_PRIVATE_KEY and PAYER_DELEGATE_PRIVATE_KEY to .env.example.

@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

The pull request introduces a new feature for delegated declarative payments in a Node.js project using the Request Network SDK. A new script delegate has been added to both README.md and package.json, which executes a new JavaScript file src/delegateDeclarePaymentSentAndReceived.js. This script demonstrates the process of creating and managing payment requests with delegate identities, including declaring payments sent and received between parties.

Changes

File Change Summary
README.md Added npm run delegate command to run new script
package.json Added new script: "delegate": "node src/delegateDeclarePaymentSentAndReceived.js"
src/delegateDeclarePaymentSentAndReceived.js New file implementing delegated payment declaration logic with waitForConfirmation function
.env.example Added environment variables: PAYEE_DELEGATE_PRIVATE_KEY and PAYER_DELEGATE_PRIVATE_KEY

Assessment against linked issues

Objective Addressed Explanation
Add delegated declarative payment usage example [#11]

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MantisClone MantisClone marked this pull request as ready for review December 20, 2024 02:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/delegateDeclarePaymentSentAndReceived.js (1)

9-249: Consider refactoring repetitive code for better maintainability.

Many repeated patterns (e.g., fromRequestId calls, delegate additions, declares, etc.) can be extracted into reusable helper functions. This will reduce code duplication and improve readability and maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b552378 and d0df5b9.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • package.json (1 hunks)
  • src/delegateDeclarePaymentSentAndReceived.js (1 hunks)
🔇 Additional comments (3)
src/delegateDeclarePaymentSentAndReceived.js (1)

24-32: Validate environment variables prior to usage.

Currently, private keys are assumed present in the environment. An explicit check (and user-friendly error message) would prevent undefined behavior or cryptic errors if the environment variables are missing or incorrect.

Also applies to: 34-44

README.md (1)

43-43: New run script is clear and consistent.

The newly introduced “npm run delegate” command aligns well with the other scripts. Great addition!

package.json (1)

13-13: Delegate script addition looks good.

The script name and command logically match the new file. No further concerns for now.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.env.example (1)

4-5: Add documentation for delegate keys

The newly added delegate private keys lack documentation explaining their purpose and usage in the context of delegate declarative payments.

Consider adding explanatory comments:

 # Must include 0x prefix
 PAYEE_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
 PAYER_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
+# Private keys for delegate accounts that can declare payments on behalf of the payee/payer
+# These are used in the delegate declarative payment flow
 PAYEE_DELEGATE_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
 PAYER_DELEGATE_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
🧰 Tools
🪛 Gitleaks (8.21.2)

4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0df5b9 and 993ea99.

📒 Files selected for processing (2)
  • .env.example (1 hunks)
  • src/delegateDeclarePaymentSentAndReceived.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/delegateDeclarePaymentSentAndReceived.js
🧰 Additional context used
🪛 Gitleaks (8.21.2)
.env.example

4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.env.example (1)

6-7: ⚠️ Potential issue

Critical Security Risk: Using identical private keys across roles

Using the same private key value (0x4025da...) for different roles (payee, payer, and their delegates) is a significant security risk, even in example code. This practice could mislead users into following the same pattern in production.

Each role should have a unique private key to demonstrate proper security practices:

-PAYEE_DELEGATE_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
-PAYER_DELEGATE_PRIVATE_KEY='0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0'
+PAYEE_DELEGATE_PRIVATE_KEY='0x9245da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c2'
+PAYER_DELEGATE_PRIVATE_KEY='0x7365da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c3'
🧰 Tools
🪛 Gitleaks (8.21.2)

6-6: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


7-7: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (1)
.env.example (1)

2-3: Enhance security warning message

While the warning is helpful, consider making it more explicit about the security implications:

-# WARNING: These are example keys. DO NOT use them to store real funds!
-# Generate unique private keys for each role using a secure method
+# WARNING: SECURITY RISK
+# These are example private keys - DO NOT use them in production or to store real funds!
+# Each role (payee, payer, and their delegates) must use unique private keys
+# Generate secure private keys using tools like:
+#   - eth-account: Account.create()
+#   - web3.js: web3.eth.accounts.create()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 993ea99 and 5233f92.

📒 Files selected for processing (1)
  • .env.example (1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
.env.example

4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


6-6: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


7-7: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

@MantisClone MantisClone self-assigned this Dec 20, 2024
@MantisClone MantisClone merged commit c44e828 into main Dec 20, 2024
1 check passed
@MantisClone MantisClone deleted the delegate-declarative branch December 20, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add delegated declarative payment usage example

3 participants