Skip to content

Commit

Permalink
Add soroban function symbol params
Browse files Browse the repository at this point in the history
  • Loading branch information
chowbao committed Dec 12, 2023
1 parent e906872 commit 384b965
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Stellar-ETL is a data pipeline that allows users to extract data from the hi
- [export_contract_data (futurenet, testnet)](#export_contract_data)
- [export_contract_code (futurenet, testnet)](#export_contract_code)
- [export_config_settings (futurenet, testnet)](#export_config_settings)
- [export_expiration (futurenet, testnet)](#export_expiration)
- [export_ttl (futurenet, testnet)](#export_ttl)
- [History Archive Commands](#history-archive-commands)
- [export_ledgers](#export_ledgers)
- [export_transactions](#export_transactions)
Expand Down Expand Up @@ -65,7 +65,7 @@ The Stellar-ETL is a data pipeline that allows users to extract data from the hi
- [export_contract_data](#export_contract_data)
- [export_contract_code](#export_contract_code)
- [export_config_settings](#export_config_settings)
- [export_expiration](#export_expiration)
- [export_ttl](#export_ttl)
- [History Archive Commands](#history-archive-commands)
- [export_ledgers](#export_ledgers)
- [export_transactions](#export_transactions)
Expand Down Expand Up @@ -186,10 +186,10 @@ Exports historical config settings data from the genesis ledger to the provided

<br>

### **export_expiration**
### **export_ttl**

```bash
> stellar-etl export_expiration --end-ledger 500000 --output export_expiration.txt
> stellar-etl export_ttl --end-ledger 500000 --output export_ttl.txt
```

Exports historical expiration data from the genesis ledger to the provided end-ledger to an output file. The command reads from the bucket list, which includes the full history of the Stellar ledger. As a result, it should be used in an initial data dump. In order to get expiration information within a specified ledger range, see the export_ledger_entry_changes command.
Expand Down
11 changes: 11 additions & 0 deletions internal/transform/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ func extractOperationDetails(operation xdr.Operation, transaction ingest.LedgerT
args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &invokeArgs.FunctionName})
args = append(args, invokeArgs.Args...)
params := make([]map[string]string, 0, len(args))
var decodedSymbolParamNames []string

details["type"] = "invoke_contract"

Expand All @@ -962,10 +963,14 @@ func extractOperationDetails(operation xdr.Operation, transaction ingest.LedgerT
if raw, err := param.MarshalBinary(); err == nil {
serializedParam["value"] = base64.StdEncoding.EncodeToString(raw)
}
if scValTypeName == "Sym" {
decodedSymbolParamNames = append(decodedSymbolParamNames, param.String())
}
}
params = append(params, serializedParam)
}
details["parameters"] = params
details["decoded_symbol_param_names"] = decodedSymbolParamNames

if balanceChanges, err := parseAssetBalanceChangesFromContractEvents(transaction, network); err != nil {
return nil, err
Expand Down Expand Up @@ -1534,6 +1539,7 @@ func (operation *transactionOperationWrapper) Details() (map[string]interface{},
args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &invokeArgs.FunctionName})
args = append(args, invokeArgs.Args...)
params := make([]map[string]string, 0, len(args))
var decodedSymbolParamNames []string

details["type"] = "invoke_contract"

Expand All @@ -1551,10 +1557,15 @@ func (operation *transactionOperationWrapper) Details() (map[string]interface{},
if raw, err := param.MarshalBinary(); err == nil {
serializedParam["value"] = base64.StdEncoding.EncodeToString(raw)
}
if scValTypeName == "Sym" {
decodedSymbolParamNames = append(decodedSymbolParamNames, param.String())
}

}
params = append(params, serializedParam)
}
details["parameters"] = params
details["decoded_symbol_param_names"] = decodedSymbolParamNames

if balanceChanges, err := operation.parseAssetBalanceChangesFromContractEvents(); err != nil {
return nil, err
Expand Down

0 comments on commit 384b965

Please sign in to comment.