自訂債券市集的包裝函式 API

債券市集包裝函式 API 是由 Blockchain App Builder 產生的包裝函式 API 套件修改版本。

如果您在將自訂方法新增至債券市集鏈碼後重新產生包裝函式 API 套件,請完成下列步驟。為了確保您的變更相容,您必須使用與產品組合的債券市集包裝函式 API 套件來修改新產生的包裝函式 API 套件。
  1. 使用 Blockchain App Builder 為債券市集鏈碼產生包裝函式 API 套件。
  2. 從套件擷取檔案。
  3. 備份 routes.go 檔案,然後將新包裝函式 API 套件中的 OCI 函數資料夾取代為隨附 BondMarketplace 包裝函式 API 套件中的 BondMarketPlaceOCIFunction 資料夾。回復 routes.go 檔案的備份版本。
  4. 將下列變數新增至 terraform.vars 檔案。
    idcs_url="<idcs_url>"
     idcs_port="<idcs_port>"
     cbdc_chaincode="<cbdc_chaincode>"
     cbdc_channel="<cbdc_channel>"
     prepare_timeout=<prepare_timeout>
     isolation_level="<isolation_level>"
  5. 編輯 terraform.vars 檔案結尾的 function_path JSON 變數,以新增任何新方法的項目。function_path 變數會將 API 端點定義為下列格式的物件陣列。
    function_paths="[{\"endpoint\":\"/addAdmin\",\"methodType\":[\"POST\"]}]"
    新增新的 createIDCSUsercreateAccountWithEnrollment 方法項目,如下列範例所示。
    function_paths="[{\"endpoint\":\"/addAdmin\",\"methodType\":[\"POST\"]},{\"endpoint\":\"/createIDCSUser\",\"methodType\":[\"POST\"]},{\"endpoint\":\"/createAccountWithEnrollment\",\"methodType\":[\"POST\"]}]"
  6. 驗證並更新修改過之方法的名稱 purchaseBondTokenapproveBondRedemptionpayInterest,以確保它們在 terraform.vars 檔案的 function_path 變數中正確命名。
  7. 將新產生的包裝函式 API 套件中的 main.tf 檔案取代為產品隨附的包裝函式 API 套件中的 main.tf 檔案。