Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc-site/docs/tutorials/custom_contracts/cardano.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ First, decide on the contract which your dApp will satisfy. FireFly uses [FireFl
This is describing a contract with a single method, named `send_ada`. This method takes three parameters: a `fromAddress`, a `toAddress`, and an `amount`.

It also emits three events:

- `TransactionAccepted(string)` is emitted when the transaction is included in a block.
- `TransactionRolledBack(string)` is emitted if the transaction was included in a block, and that block got rolled back. This happens maybe once or twice a day on the Cardano network, which is more likely than some other chains, so your code must be able to gracefully handle rollbacks.
- `TransactionFinalized(string)` is emitted when the transaction has been on the chain for "long enough" that it is effectively immutable. It is up to your tolerance risk.
Expand All @@ -121,7 +122,7 @@ edition = "2021"

[dependencies]
# The version of firefly-balius should match the version of firefly-cardano which you are using.
firefly-balius = { git = "https://github.com/hyperledger/firefly-cardano", rev = "0.4.2" }
firefly-balius = { git = "https://github.com/hyperledger/firefly-cardano", rev = "<firefly cardano version>" }
pallas-addresses = "0.32"
serde = { version = "1", features = ["derive"] }

Expand Down Expand Up @@ -236,14 +237,15 @@ fn main() -> Worker {

You can use the `firefly-cardano-deploy` tool to deploy this dApp to your running FireFly instance.
This tool will

- Compile your dApp to WebAssembly
- Deploy that WebAssembly to a running FireFly node
- Deploy your interface to that FireFly node
- Create an API for that interface

```sh
# The version here should match the version of firefly-cardano which you are using.
cargo install --git https://github.com/hyperledger/firefly-cardano --version 0.3.1 firefly-cardano-deploy
cargo install --git https://github.com/hyperledger/firefly-cardano --version <firefly cardano version> firefly-cardano-deploy

CONTRACT_PATH="/path/to/your/dapp"
FIREFLY_URL="http://localhost:5000"
Expand Down
10 changes: 5 additions & 5 deletions internal/blockchain/cardano/cardano.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (c *Cardano) Init(ctx context.Context, cancelCtx context.CancelFunc, conf c
}

if c.wsConfig.WSKeyPath == "" {
c.wsConfig.WSKeyPath = "/ws"
c.wsConfig.WSKeyPath = "/api/v1/ws"
}

c.streamIDs = make(map[string]string)
Expand Down Expand Up @@ -243,7 +243,7 @@ func (c *Cardano) DeployContract(ctx context.Context, nsOpID, signingKey string,
SetContext(ctx).
SetBody(body).
SetError(&resErr).
Post("/contracts/deploy")
Post("/api/v1/contracts/deploy")
if err != nil || !res.IsSuccess() {
return resErr.SubmissionRejected, common.WrapRESTError(ctx, &resErr, res, err, coremsgs.MsgCardanoconnectRESTErr)
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func (c *Cardano) InvokeContract(ctx context.Context, nsOpID string, signingKey
SetContext(ctx).
SetBody(body).
SetError(&resErr).
Post("/contracts/invoke")
Post("/api/v1/contracts/invoke")
if err != nil || !res.IsSuccess() {
return resErr.SubmissionRejected, common.WrapRESTError(ctx, &resErr, res, err, coremsgs.MsgCardanoconnectRESTErr)
}
Expand Down Expand Up @@ -324,7 +324,7 @@ func (c *Cardano) QueryContract(ctx context.Context, signingKey string, location
SetContext(ctx).
SetBody(body).
SetError(&resErr).
Post("/contracts/query")
Post("/api/v1/contracts/query")
if err != nil || !res.IsSuccess() {
return nil, common.WrapRESTError(ctx, &resErr, res, err, coremsgs.MsgCardanoconnectRESTErr)
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func (c *Cardano) GetAndConvertDeprecatedContractConfig(ctx context.Context) (lo
func (c *Cardano) GetTransactionStatus(ctx context.Context, operation *core.Operation) (interface{}, error) {
txnID := (&core.PreparedOperation{ID: operation.ID, Namespace: operation.Namespace}).NamespacedIDString()

transactionRequestPath := fmt.Sprintf("/transactions/%s", txnID)
transactionRequestPath := fmt.Sprintf("/api/v1/transactions/%s", txnID)
client := c.client
var resErr common.BlockchainRESTError
var statusResponse fftypes.JSONObject
Expand Down
Loading