@meshsdk/contract 1.6.0-alpha.21 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/index.cjs +37 -0
  2. package/dist/{index.d.mts → index.d.cts} +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +28 -1803
  5. package/package.json +30 -14
  6. package/.turbo/turbo-build$colon$docs.log +0 -8
  7. package/.turbo/turbo-build$colon$mesh.log +0 -19
  8. package/dist/index.mjs +0 -1834
  9. package/src/common.ts +0 -186
  10. package/src/coupon-bond-guaranteed/aiken-workspace/readme.md +0 -0
  11. package/src/coupon-bond-guaranteed/offchain.ts +0 -3
  12. package/src/coupon-bond-guaranteed/readme.md +0 -3
  13. package/src/escrow/aiken-workspace/aiken.lock +0 -26
  14. package/src/escrow/aiken-workspace/aiken.toml +0 -19
  15. package/src/escrow/aiken-workspace/lib/escrow/types.ak +0 -21
  16. package/src/escrow/aiken-workspace/lib/escrow/validators/escrow.ak +0 -122
  17. package/src/escrow/aiken-workspace/plutus.json +0 -238
  18. package/src/escrow/aiken-workspace/readme.md +0 -55
  19. package/src/escrow/aiken-workspace/validators/escrow.ak +0 -9
  20. package/src/escrow/aiken-workspace/validators/tests/escrow.ak +0 -462
  21. package/src/escrow/index.ts +0 -1
  22. package/src/escrow/offchain.ts +0 -254
  23. package/src/escrow/readme.md +0 -38
  24. package/src/giftcard/aiken-workspace/aiken.lock +0 -26
  25. package/src/giftcard/aiken-workspace/aiken.toml +0 -19
  26. package/src/giftcard/aiken-workspace/plutus.json +0 -138
  27. package/src/giftcard/aiken-workspace/readme.md +0 -55
  28. package/src/giftcard/aiken-workspace/validators/oneshot.ak +0 -173
  29. package/src/giftcard/index.ts +0 -1
  30. package/src/giftcard/offchain.ts +0 -184
  31. package/src/giftcard/readme.md +0 -36
  32. package/src/hello-world/aiken-workspace/README.md +0 -19
  33. package/src/hello-world/aiken-workspace/aiken.lock +0 -15
  34. package/src/hello-world/aiken-workspace/aiken.toml +0 -14
  35. package/src/hello-world/aiken-workspace/contract.md +0 -27
  36. package/src/hello-world/aiken-workspace/plutus.json +0 -69
  37. package/src/hello-world/aiken-workspace/validators/hello_world.ak +0 -24
  38. package/src/hello-world/index.ts +0 -1
  39. package/src/hello-world/offchain.ts +0 -24
  40. package/src/hello-world/readme.md +0 -1
  41. package/src/index.ts +0 -6
  42. package/src/marketplace/aiken-workspace/aiken.lock +0 -26
  43. package/src/marketplace/aiken-workspace/aiken.toml +0 -19
  44. package/src/marketplace/aiken-workspace/lib/marketplace/types.ak +0 -15
  45. package/src/marketplace/aiken-workspace/lib/marketplace/validators/marketplace.ak +0 -52
  46. package/src/marketplace/aiken-workspace/plutus.json +0 -204
  47. package/src/marketplace/aiken-workspace/readme.md +0 -55
  48. package/src/marketplace/aiken-workspace/validators/marketplace.ak +0 -14
  49. package/src/marketplace/aiken-workspace/validators/tests/marketplace.ak +0 -218
  50. package/src/marketplace/index.ts +0 -1
  51. package/src/marketplace/offchain.ts +0 -248
  52. package/src/marketplace/readme.md +0 -45
  53. package/src/payment-splitter/aiken-workspace/aiken.lock +0 -15
  54. package/src/payment-splitter/aiken-workspace/aiken.toml +0 -14
  55. package/src/payment-splitter/aiken-workspace/plutus.json +0 -83
  56. package/src/payment-splitter/aiken-workspace/validators/payment-splitter.ak +0 -329
  57. package/src/payment-splitter/index.ts +0 -1
  58. package/src/payment-splitter/offchain.ts +0 -143
  59. package/src/payment-splitter/readme.md +0 -100
  60. package/src/swap/aiken-workspace/aiken.lock +0 -26
  61. package/src/swap/aiken-workspace/aiken.toml +0 -19
  62. package/src/swap/aiken-workspace/plutus.json +0 -208
  63. package/src/swap/aiken-workspace/readme.md +0 -55
  64. package/src/swap/aiken-workspace/validators/swap.ak +0 -188
  65. package/src/swap/index.ts +0 -1
  66. package/src/swap/offchain.ts +0 -139
  67. package/src/swap/readme.md +0 -35
  68. package/src/vesting/aiken-workspace/README.md +0 -24
  69. package/src/vesting/aiken-workspace/aiken.lock +0 -26
  70. package/src/vesting/aiken-workspace/aiken.toml +0 -19
  71. package/src/vesting/aiken-workspace/lib/vesting/types.ak +0 -8
  72. package/src/vesting/aiken-workspace/lib/vesting/validators/vesting.ak +0 -19
  73. package/src/vesting/aiken-workspace/plutus.json +0 -67
  74. package/src/vesting/aiken-workspace/validators/tests/vesting.ak +0 -108
  75. package/src/vesting/aiken-workspace/validators/vesting.ak +0 -9
  76. package/src/vesting/index.ts +0 -1
  77. package/src/vesting/offchain.ts +0 -117
  78. package/src/vesting/readme.md +0 -36
  79. package/tsconfig.json +0 -5
package/src/common.ts DELETED
@@ -1,186 +0,0 @@
1
- import {
2
- BrowserWallet,
3
- IFetcher,
4
- MeshTxBuilder,
5
- MeshWallet,
6
- UTxO,
7
- } from "@meshsdk/core";
8
- import { v2ScriptToBech32 } from "@meshsdk/core-csl";
9
-
10
- export type MeshTxInitiatorInput = {
11
- mesh: MeshTxBuilder;
12
- fetcher?: IFetcher;
13
- wallet?: BrowserWallet | MeshWallet;
14
- networkId?: number;
15
- stakeCredential?: string;
16
- };
17
-
18
- export class MeshTxInitiator {
19
- mesh: MeshTxBuilder;
20
- fetcher?: IFetcher;
21
- wallet?: BrowserWallet | MeshWallet;
22
- stakeCredential?: string;
23
- networkId = 0;
24
-
25
- constructor({
26
- mesh,
27
- fetcher,
28
- wallet,
29
- networkId,
30
- stakeCredential,
31
- }: MeshTxInitiatorInput) {
32
- this.mesh = mesh;
33
- if (fetcher) {
34
- this.fetcher = fetcher;
35
- }
36
- if (wallet) {
37
- this.wallet = wallet;
38
- }
39
- if (networkId) {
40
- this.networkId = networkId;
41
- }
42
- if (stakeCredential) {
43
- this.stakeCredential = this.stakeCredential;
44
- }
45
- }
46
-
47
- protected signSubmitReset = async () => {
48
- const signedTx = this.mesh.completeSigning();
49
- const txHash = await this.mesh.submitTx(signedTx);
50
- this.mesh.reset();
51
- return txHash;
52
- };
53
-
54
- protected queryUtxos = async (walletAddress: string): Promise<UTxO[]> => {
55
- if (this.fetcher) {
56
- const utxos = await this.fetcher.fetchAddressUTxOs(walletAddress);
57
- return utxos;
58
- }
59
- return [];
60
- };
61
-
62
- protected getWalletDappAddress = async () => {
63
- if (this.wallet) {
64
- const usedAddresses = await this.wallet.getUsedAddresses();
65
- if (usedAddresses.length > 0) {
66
- return usedAddresses[0];
67
- }
68
- const unusedAddresses = await this.wallet.getUnusedAddresses();
69
- if (unusedAddresses.length > 0) {
70
- return unusedAddresses[0];
71
- }
72
- }
73
- return "";
74
- };
75
-
76
- protected getWalletCollateral = async (): Promise<UTxO | undefined> => {
77
- if (this.wallet) {
78
- const utxos = await this.wallet.getCollateral();
79
- return utxos[0];
80
- }
81
- return undefined;
82
- };
83
-
84
- protected getWalletUtxosWithMinLovelace = async (
85
- lovelace: number,
86
- providedUtxos: UTxO[] = [],
87
- ) => {
88
- let utxos: UTxO[] = providedUtxos;
89
- if (this.wallet && (!providedUtxos || providedUtxos.length === 0)) {
90
- utxos = await this.wallet.getUtxos();
91
- }
92
- return utxos.filter((u) => {
93
- const lovelaceAmount = u.output.amount.find(
94
- (a: any) => a.unit === "lovelace",
95
- )?.quantity;
96
- return Number(lovelaceAmount) > lovelace;
97
- });
98
- };
99
-
100
- protected getWalletUtxosWithToken = async (
101
- assetHex: string,
102
- userUtxos: UTxO[] = [],
103
- ) => {
104
- let utxos: UTxO[] = userUtxos;
105
- if (this.wallet && userUtxos.length === 0) {
106
- utxos = await this.wallet.getUtxos();
107
- }
108
- return utxos.filter((u) => {
109
- const assetAmount = u.output.amount.find(
110
- (a: any) => a.unit === assetHex,
111
- )?.quantity;
112
- return Number(assetAmount) >= 1;
113
- });
114
- };
115
-
116
- protected getAddressUtxosWithMinLovelace = async (
117
- walletAddress: string,
118
- lovelace: number,
119
- providedUtxos: UTxO[] = [],
120
- ) => {
121
- let utxos: UTxO[] = providedUtxos;
122
- if (this.fetcher && (!providedUtxos || providedUtxos.length === 0)) {
123
- utxos = await this.fetcher.fetchAddressUTxOs(walletAddress);
124
- }
125
- return utxos.filter((u) => {
126
- const lovelaceAmount = u.output.amount.find(
127
- (a: any) => a.unit === "lovelace",
128
- )?.quantity;
129
- return Number(lovelaceAmount) > lovelace;
130
- });
131
- };
132
-
133
- protected getAddressUtxosWithToken = async (
134
- walletAddress: string,
135
- assetHex: string,
136
- userUtxos: UTxO[] = [],
137
- ) => {
138
- let utxos: UTxO[] = userUtxos;
139
- if (this.fetcher && userUtxos.length === 0) {
140
- utxos = await this.fetcher.fetchAddressUTxOs(walletAddress);
141
- }
142
- return utxos.filter((u) => {
143
- const assetAmount = u.output.amount.find(
144
- (a: any) => a.unit === assetHex,
145
- )?.quantity;
146
- return Number(assetAmount) >= 1;
147
- });
148
- };
149
-
150
- protected getWalletInfoForTx = async () => {
151
- const utxos = await this.wallet?.getUtxos();
152
- const collateral = await this.getWalletCollateral();
153
- const walletAddress = await this.getWalletDappAddress();
154
- if (!utxos || utxos?.length === 0) {
155
- throw new Error("No utxos found");
156
- }
157
- if (!collateral) {
158
- throw new Error("No collateral found");
159
- }
160
- if (!walletAddress) {
161
- throw new Error("No wallet address found");
162
- }
163
- return { utxos, collateral, walletAddress };
164
- };
165
-
166
- protected _getUtxoByTxHash = async (
167
- scriptCbor: string,
168
- txHash: string,
169
- ): Promise<UTxO | undefined> => {
170
- if (this.fetcher) {
171
- const utxos = await this.fetcher?.fetchUTxOs(txHash);
172
- const scriptAddr = v2ScriptToBech32(
173
- scriptCbor,
174
- undefined,
175
- this.networkId,
176
- );
177
-
178
- const scriptUtxo =
179
- utxos.filter((utxo) => utxo.output.address === scriptAddr)[0] ||
180
- utxos[0];
181
- return scriptUtxo;
182
- }
183
-
184
- return undefined;
185
- };
186
- }
@@ -1,3 +0,0 @@
1
- import { MeshTxInitiator } from "../common";
2
-
3
- export class MeshCouponBondContract extends MeshTxInitiator {}
@@ -1,3 +0,0 @@
1
- # Coupon Bond Guaranteed
2
-
3
- Debt agreement between an "Lender" and an "Borrower". "Lender" will advance the "Principal" amount at the beginning of the contract, and the "Borrower" will pay back "Interest instalment" every 30 slots and the "Principal" amount by the end of 3 instalments. The debt is backed by a collateral provided by the "Guarantor" which will be refunded as long as the "Borrower" pays back on time.
@@ -1,26 +0,0 @@
1
- # This file was generated by Aiken
2
- # You typically do not need to edit this file
3
-
4
- [[requirements]]
5
- name = "aiken-lang/stdlib"
6
- version = "1.9.0"
7
- source = "github"
8
-
9
- [[requirements]]
10
- name = "sidan-lab/aiken-utils"
11
- version = "0.1.6-beta"
12
- source = "github"
13
-
14
- [[packages]]
15
- name = "aiken-lang/stdlib"
16
- version = "1.9.0"
17
- requirements = []
18
- source = "github"
19
-
20
- [[packages]]
21
- name = "sidan-lab/aiken-utils"
22
- version = "0.1.6-beta"
23
- requirements = []
24
- source = "github"
25
-
26
- [etags]
@@ -1,19 +0,0 @@
1
- name = "meshjs/escrow"
2
- version = "0.0.0"
3
- license = "Apache-2.0"
4
- description = "Aiken contracts for project 'meshjs/escrow'"
5
-
6
- [repository]
7
- user = "meshjs"
8
- project = "escrow"
9
- platform = "github"
10
-
11
- [[dependencies]]
12
- name = "aiken-lang/stdlib"
13
- version = "1.9.0"
14
- source = "github"
15
-
16
- [[dependencies]]
17
- name = "sidan-lab/aiken-utils"
18
- version = "0.1.6-beta"
19
- source = "github"
@@ -1,21 +0,0 @@
1
- use aiken/transaction/credential.{Address}
2
- use aiken/transaction/value.{AssetName, PolicyId}
3
-
4
- pub type MValue =
5
- Pairs<PolicyId, Pairs<AssetName, Int>>
6
-
7
- pub type EscrowDatum {
8
- Initiation { initiator: Address, initiator_assets: MValue }
9
- ActiveEscrow {
10
- initiator: Address,
11
- initiator_assets: MValue,
12
- recipient: Address,
13
- recipient_assets: MValue,
14
- }
15
- }
16
-
17
- pub type EscrowRedeemer {
18
- RecipientDeposit { recipient: Address, recipient_assets: MValue }
19
- CancelTrade
20
- CompleteTrade
21
- }
@@ -1,122 +0,0 @@
1
- use aiken/transaction.{
2
- InlineDatum, Input, ScriptContext, Spend, Transaction, find_input,
3
- }
4
- use aiken/transaction/value.{from_asset_list, merge}
5
- use escrow/types.{
6
- ActiveEscrow, CancelTrade, CompleteTrade, EscrowDatum, EscrowRedeemer,
7
- Initiation, RecipientDeposit,
8
- }
9
- use sidan_utils/address.{address_pub_key}
10
- use sidan_utils/extra_signatories.{
11
- all_key_signed, key_signed, one_of_keys_signed,
12
- }
13
- use sidan_utils/inputs.{inputs_at}
14
- use sidan_utils/outputs.{outputs_at}
15
- use sidan_utils/value.{get_all_value_to, value_geq} as sidan_value
16
-
17
- pub fn escrow_logic(
18
- _datum: EscrowDatum,
19
- redeemer: EscrowRedeemer,
20
- ctx: ScriptContext,
21
- ) {
22
- when ctx.purpose is {
23
- Spend(utxo) -> {
24
- let Transaction { inputs, outputs, extra_signatories, .. } =
25
- ctx.transaction
26
- expect Some(own_input) = find_input(inputs, utxo)
27
- let own_address = own_input.output.address
28
- when redeemer is {
29
- RecipientDeposit { recipient, recipient_assets } -> {
30
- expect ([input], [output]) =
31
- (inputs_at(inputs, own_address), outputs_at(outputs, own_address))
32
- // Only 1 input & output from same address
33
- expect InlineDatum(raw_input_datum) = input.output.datum
34
- expect InlineDatum(raw_output_datum) = output.datum
35
- expect Initiation { initiator, initiator_assets }: EscrowDatum =
36
- raw_input_datum
37
- expect output_datum: EscrowDatum = raw_output_datum
38
- let is_datum_updated =
39
- output_datum == ActiveEscrow {
40
- initiator,
41
- recipient,
42
- initiator_assets,
43
- recipient_assets,
44
- }
45
- let is_value_deposited =
46
- value_geq(
47
- output.value,
48
- input.output.value |> merge(recipient_assets |> from_asset_list()),
49
- )
50
- is_datum_updated && is_value_deposited
51
- }
52
- CancelTrade -> {
53
- expect ([input], []) =
54
- (inputs_at(inputs, own_address), outputs_at(outputs, own_address))
55
- expect InlineDatum(raw_input_datum) = input.output.datum
56
- expect input_datum: EscrowDatum = raw_input_datum
57
- when input_datum is {
58
- Initiation { initiator, .. } -> {
59
- expect Some(pub_key) = address_pub_key(initiator)
60
- key_signed(extra_signatories, pub_key)
61
- }
62
-
63
- ActiveEscrow {
64
- initiator,
65
- recipient,
66
- initiator_assets,
67
- recipient_assets,
68
- } -> {
69
- let initiator_received = get_all_value_to(outputs, initiator)
70
- let recipient_received = get_all_value_to(outputs, recipient)
71
- let is_initiator_received_value =
72
- value_geq(
73
- initiator_received,
74
- initiator_assets |> from_asset_list(),
75
- )
76
- let is_recipient_received_value =
77
- value_geq(
78
- recipient_received,
79
- recipient_assets |> from_asset_list(),
80
- )
81
- expect Some(initiator_pub_key) = address_pub_key(initiator)
82
- expect Some(recipient_pub_key) = address_pub_key(recipient)
83
- let is_any_party_signed =
84
- one_of_keys_signed(
85
- extra_signatories,
86
- [initiator_pub_key, recipient_pub_key],
87
- )
88
- is_any_party_signed && is_initiator_received_value && is_recipient_received_value
89
- }
90
- }
91
- }
92
- CompleteTrade -> {
93
- expect ([input], []) =
94
- (inputs_at(inputs, own_address), outputs_at(outputs, own_address))
95
- expect InlineDatum(raw_input_datum) = input.output.datum
96
- expect ActiveEscrow {
97
- initiator,
98
- recipient,
99
- initiator_assets,
100
- recipient_assets,
101
- }: EscrowDatum = raw_input_datum
102
- let initiator_received = get_all_value_to(outputs, initiator)
103
- let recipient_received = get_all_value_to(outputs, recipient)
104
- let is_initiator_received_value =
105
- value_geq(initiator_received, recipient_assets |> from_asset_list())
106
- let is_recipient_received_value =
107
- value_geq(recipient_received, initiator_assets |> from_asset_list())
108
- expect Some(initiator_pub_key) = address_pub_key(initiator)
109
- expect Some(recipient_pub_key) = address_pub_key(recipient)
110
- let is_both_parties_signed =
111
- all_key_signed(
112
- extra_signatories,
113
- [initiator_pub_key, recipient_pub_key],
114
- )
115
- is_both_parties_signed && is_initiator_received_value && is_recipient_received_value
116
- }
117
- }
118
- }
119
-
120
- _ -> False
121
- }
122
- }
@@ -1,238 +0,0 @@
1
- {
2
- "preamble": {
3
- "title": "meshjs/escrow",
4
- "description": "Aiken contracts for project 'meshjs/escrow'",
5
- "version": "0.0.0",
6
- "plutusVersion": "v2",
7
- "compiler": {
8
- "name": "Aiken",
9
- "version": "v1.0.29-alpha+unknown"
10
- },
11
- "license": "Apache-2.0"
12
- },
13
- "validators": [
14
- {
15
- "title": "escrow.escrow",
16
- "datum": {
17
- "title": "datum",
18
- "schema": {
19
- "$ref": "#/definitions/escrow~1types~1EscrowDatum"
20
- }
21
- },
22
- "redeemer": {
23
- "title": "redeemer",
24
- "schema": {
25
- "$ref": "#/definitions/escrow~1types~1EscrowRedeemer"
26
- }
27
- },
28
- "compiledCode": "590c2f01000032323232323232232323232323232232322533300d323232323232323232323232323232533301c3019301d37540022646464646464a666044604060466ea80044c8c94ccc090c0880044c8c8c8c8c8c8c94ccc0b8c0c400c4c94ccc0bcc0c800c4c94ccc0b4c08cc0b8dd5000899192999817981298181baa0011325333030302e30313754006264646464a66606e6074004264646464a66607066ebc024cdd2a40046607800e660786e98014cc0f004ccc0f0dd300925eb804004528198111bab302830393754018660426eacc0a0c0e4dd51814181c9baa00d3020011302f0073302f00223233031375660720044646eb4c0ec008dd7181c8009bae3037001302f00316375660700026070004606c00260646ea800c58c0d0c0c4dd50008b180d98181baa0033032302f37540022c6032605c6ea8c074c0b8dd50010b18180010b18178011bac302e302f0023758605a002660566e9ccc058028014cc0acdd39980a804002a5eb80dd598159816001181500098131baa01b153330243021001132323232533302b302e0031533302b0021325333029301f302a375400226464a666056605260586ea80084c94ccc0b0c0a8c0b4dd50008998098061bae3031302e37540022c60266060605a6ea80084c8c8c8c8c8c8c8c94ccc0ccc0c4c0d0dd500089919299981a9819981b1baa0011533303532330010013303a375200666074607660706ea80092f5c044a66607400229404c94ccc0e0cc07c060dd7181e8010a51133003003001303d00115333035005100414a0294058c070014dd7181c181a9baa00116301a0063301c33017012002301a3756606c606e006660366602c02200860326eacc0d400cc0d0004c0d0004c0cc008c0c4004c0b4dd50011811800981718159baa001163015302a3754603260546ea80045858c0b0008dd6181598160011bac302a00133028374e6602600e004660506e9ccc0480140092f5c0264646464a666056605c0062a666056004264a666052603e60546ea80044c94ccc0a8c09cc0acdd500089919191919191919299981a981c001099191919191919299981c981b981d1baa00113232533303b3039303c37540022a6660766466002002660806ea400ccc100c104c0f8dd500125eb80894ccc100004528899299981f1981280f1bae304300213300300300114a060860022a66607600a200829405280b18110059bae303e303b37540022c604001a660446603a0300106040014660426603802e016603e00a6605e008464660626eacc0e40088c8dd6981d8011bae3039001375c606e002605e00a6605a00c4646605e6eacc0dc0088c8dd6981c8011bae3037001375c606a002605a00e2c6eacc0d8004c0d8008c0d0004c0d0008dd598190009819001181800098161baa00116302e302b37540022c602a60546ea8c064c0a8dd50008b0b18160011bac302b302c00237586054002660506e9ccc04c01c008cc0a0dd39980900280125eb80c090dd500d180918121baa301330243754604e60486ea800458c8c8cc004004018894ccc09c004530103d87a80001323253330263375e602c60506ea80080144c048cc0a80092f5c026600800800260560046052002604c60466ea8018dd618129813181318131813181318130011bac30240013024302400237586044002603c6ea8c030c078dd50080a50300c301d375401e44646600200200644a666042002297adef6c601332253330203375e602060446ea80080144cc028004dd5980898111baa0021001302300133002002302400122323300100100322533302000114a0264a66603c66e3cdd718118010020a511330030030013023001232533301a3018301b37540022600c6603c603e60386ea80052f5c02980103d87a80003009301b37540024646600200200444a66603a002297adef6c6013322323233330110030020012226323200232323300100100322533302400114984c94ccc09400454ccc088c010dd6981218138010a4c2c264646464a66604c66e40dd718138021bae30270031533302630080011330070073302a0030021616375a604e00660540066050004604e004604e002466603e603a002941289bab301f003375c603a004603e0026600400460400024464666002002006004444a66603c00420022646660080086044006666601e0046eb8c074004dd5980f00091119299981029998118008a5114a02980103d87a80001300c33024374c00297ae0323330010010030022225333025002100113233300400430290033322323300100100522533302a00113302b337606ea4010dd4001a5eb7bdb1804c8c8c8c94ccc0accdc800400109981799bb037520106ea001c01454ccc0accdc78040010992999816181518169baa001133030337606ea4024c0c4c0b8dd5000802080219299981618150008a60103d87a80001301833030375000297ae03370000e00226605e66ec0dd48011ba800133006006003375a60580066eb8c0a8008c0b8008c0b0004dd718120009bad302500130270023020002223233001001323300100100322533301d00114bd7009919991119198008008019129998118008801899198129ba733025375200c6604a60440026604a604600297ae03300300330270023025001375c60380026eacc074004cc00c00cc084008c07c004894ccc070004528899299980d1919b89375a6010002664464a66603c6036603e6ea8004520001375a604660406ea8004c94ccc078c06cc07cdd50008a6103d87a8000132330010013756604860426ea8008894ccc08c004530103d87a80001323232325333024337220100042a66604866e3c0200084c040cc0a0dd4000a5eb80530103d87a8000133006006003375a604a0066eb8c08c008c09c008c094004c8cc004004024894ccc0880045300103d87a80001323232325333023337220100042a66604666e3c0200084c03ccc09cdd3000a5eb80530103d87a8000133006006003375660480066eb8c088008c098008c090004dd718058009bae300c0013758603e0042660060060022940c07c004dd2a40004603260346034002446600c004466ebcc014c05cdd50008011119802801119baf300430163754600a602c6ea80040088c0580048c054c05800488c8cc00400400c894ccc05400452f5c026464a666028600a004266030004660080080022660080080026032004602e0024444646600200200a44a66602c00226602e66ec0dd48029ba60044bd6f7b630099191919299980b99b9000900213301b337606ea4024dd30040028a99980b99b8f009002132533301830163019375400226603866ec0dd4805180e980d1baa001004100433300700900800113301b337606ea4008dd3000998030030019bab3018003375c602c0046034004603000229309b2b19299980618050008991919192999809980b0010991924c660160044646601a6eacc0540088c8dd6980b8011bae3015001375c602600260160062c6eacc050004c050008c048004c038dd50018a99980618048008a99980798071baa00314985854ccc030c00800454ccc03cc038dd50018a4c2c2c60186ea8008dc3a4008600200e464a666012600e002264646464a6660206026004264649319804001119198051bab3012002232375a60280046eb8c048004dd7180800098040018b1bab30110013011002300f001300b37540042a666012600c00226464646464646464a666028602e0042646464649319807002119198081bab3018002232375a60340046eb8c060004dd7180b000980700299806003119198071bab3016002232375a60300046eb8c058004dd7180a00098060038b1bab3015001301500230130013013002375660220026022004601e00260166ea800858c024dd50009119198008008019129998068008a4c2646600600660220046006601e0024a66600c6008600e6ea80044c8c8c8c94ccc034c0400084c8c92632533300c300a0011323253330113014002132498c94ccc03cc0340044c8c94ccc050c05c0084c926300d001163015001301137540042a66601e60180022646464646464a66603060360042930b1bad30190013019002375a602e002602e0046eb4c054004c044dd50010b18079baa001163012001300e37540062a66601860120022a66601e601c6ea800c5261616300c3754004600c0062c601c002601c004601800260106ea8004588c94ccc018c0100044c8c94ccc02cc03800852616375c601800260106ea800854ccc018c00c0044c8c94ccc02cc03800852616375c601800260106ea800858c018dd50009b8748008dc3a4000ae6955ceaab9e5573eae815d0aba201",
29
- "hash": "bb0ead2a88fda451e0e5e01ff096309c06c1a6eb2206209d20243aaa"
30
- }
31
- ],
32
- "definitions": {
33
- "ByteArray": {
34
- "dataType": "bytes"
35
- },
36
- "Int": {
37
- "dataType": "integer"
38
- },
39
- "List$Pair$ByteArray_Int": {
40
- "dataType": "map",
41
- "keys": {
42
- "$ref": "#/definitions/ByteArray"
43
- },
44
- "values": {
45
- "$ref": "#/definitions/Int"
46
- }
47
- },
48
- "List$Pair$ByteArray_List$Pair$ByteArray_Int": {
49
- "dataType": "map",
50
- "keys": {
51
- "$ref": "#/definitions/ByteArray"
52
- },
53
- "values": {
54
- "$ref": "#/definitions/List$Pair$ByteArray_Int"
55
- }
56
- },
57
- "Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
58
- "title": "Optional",
59
- "anyOf": [
60
- {
61
- "title": "Some",
62
- "description": "An optional value.",
63
- "dataType": "constructor",
64
- "index": 0,
65
- "fields": [
66
- {
67
- "$ref": "#/definitions/aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential"
68
- }
69
- ]
70
- },
71
- {
72
- "title": "None",
73
- "description": "Nothing.",
74
- "dataType": "constructor",
75
- "index": 1,
76
- "fields": []
77
- }
78
- ]
79
- },
80
- "aiken/transaction/credential/Address": {
81
- "title": "Address",
82
- "description": "A Cardano `Address` typically holding one or two credential references.\n\n Note that legacy bootstrap addresses (a.k.a. 'Byron addresses') are\n completely excluded from Plutus contexts. Thus, from an on-chain\n perspective only exists addresses of type 00, 01, ..., 07 as detailed\n in [CIP-0019 :: Shelley Addresses](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0019/#shelley-addresses).",
83
- "anyOf": [
84
- {
85
- "title": "Address",
86
- "dataType": "constructor",
87
- "index": 0,
88
- "fields": [
89
- {
90
- "title": "payment_credential",
91
- "$ref": "#/definitions/aiken~1transaction~1credential~1Credential"
92
- },
93
- {
94
- "title": "stake_credential",
95
- "$ref": "#/definitions/Option$aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential"
96
- }
97
- ]
98
- }
99
- ]
100
- },
101
- "aiken/transaction/credential/Credential": {
102
- "title": "Credential",
103
- "description": "A general structure for representing an on-chain `Credential`.\n\n Credentials are always one of two kinds: a direct public/private key\n pair, or a script (native or Plutus).",
104
- "anyOf": [
105
- {
106
- "title": "VerificationKeyCredential",
107
- "dataType": "constructor",
108
- "index": 0,
109
- "fields": [
110
- {
111
- "$ref": "#/definitions/ByteArray"
112
- }
113
- ]
114
- },
115
- {
116
- "title": "ScriptCredential",
117
- "dataType": "constructor",
118
- "index": 1,
119
- "fields": [
120
- {
121
- "$ref": "#/definitions/ByteArray"
122
- }
123
- ]
124
- }
125
- ]
126
- },
127
- "aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
128
- "title": "Referenced",
129
- "description": "Represent a type of object that can be represented either inline (by hash)\n or via a reference (i.e. a pointer to an on-chain location).\n\n This is mainly use for capturing pointers to a stake credential\n registration certificate in the case of so-called pointer addresses.",
130
- "anyOf": [
131
- {
132
- "title": "Inline",
133
- "dataType": "constructor",
134
- "index": 0,
135
- "fields": [
136
- {
137
- "$ref": "#/definitions/aiken~1transaction~1credential~1Credential"
138
- }
139
- ]
140
- },
141
- {
142
- "title": "Pointer",
143
- "dataType": "constructor",
144
- "index": 1,
145
- "fields": [
146
- {
147
- "title": "slot_number",
148
- "$ref": "#/definitions/Int"
149
- },
150
- {
151
- "title": "transaction_index",
152
- "$ref": "#/definitions/Int"
153
- },
154
- {
155
- "title": "certificate_index",
156
- "$ref": "#/definitions/Int"
157
- }
158
- ]
159
- }
160
- ]
161
- },
162
- "escrow/types/EscrowDatum": {
163
- "title": "EscrowDatum",
164
- "anyOf": [
165
- {
166
- "title": "Initiation",
167
- "dataType": "constructor",
168
- "index": 0,
169
- "fields": [
170
- {
171
- "title": "initiator",
172
- "$ref": "#/definitions/aiken~1transaction~1credential~1Address"
173
- },
174
- {
175
- "title": "initiator_assets",
176
- "$ref": "#/definitions/List$Pair$ByteArray_List$Pair$ByteArray_Int"
177
- }
178
- ]
179
- },
180
- {
181
- "title": "ActiveEscrow",
182
- "dataType": "constructor",
183
- "index": 1,
184
- "fields": [
185
- {
186
- "title": "initiator",
187
- "$ref": "#/definitions/aiken~1transaction~1credential~1Address"
188
- },
189
- {
190
- "title": "initiator_assets",
191
- "$ref": "#/definitions/List$Pair$ByteArray_List$Pair$ByteArray_Int"
192
- },
193
- {
194
- "title": "recipient",
195
- "$ref": "#/definitions/aiken~1transaction~1credential~1Address"
196
- },
197
- {
198
- "title": "recipient_assets",
199
- "$ref": "#/definitions/List$Pair$ByteArray_List$Pair$ByteArray_Int"
200
- }
201
- ]
202
- }
203
- ]
204
- },
205
- "escrow/types/EscrowRedeemer": {
206
- "title": "EscrowRedeemer",
207
- "anyOf": [
208
- {
209
- "title": "RecipientDeposit",
210
- "dataType": "constructor",
211
- "index": 0,
212
- "fields": [
213
- {
214
- "title": "recipient",
215
- "$ref": "#/definitions/aiken~1transaction~1credential~1Address"
216
- },
217
- {
218
- "title": "recipient_assets",
219
- "$ref": "#/definitions/List$Pair$ByteArray_List$Pair$ByteArray_Int"
220
- }
221
- ]
222
- },
223
- {
224
- "title": "CancelTrade",
225
- "dataType": "constructor",
226
- "index": 1,
227
- "fields": []
228
- },
229
- {
230
- "title": "CompleteTrade",
231
- "dataType": "constructor",
232
- "index": 2,
233
- "fields": []
234
- }
235
- ]
236
- }
237
- }
238
- }
@@ -1,55 +0,0 @@
1
- # escrow
2
-
3
- Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension.
4
-
5
- For example, as `validators/always_true.ak`
6
-
7
- ```gleam
8
- validator {
9
- fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool {
10
- True
11
- }
12
- }
13
- ```
14
-
15
- ## Building
16
-
17
- ```sh
18
- aiken build
19
- ```
20
-
21
- ## Testing
22
-
23
- You can write tests in any module using the `test` keyword. For example:
24
-
25
- ```gleam
26
- test foo() {
27
- 1 + 1 == 2
28
- }
29
- ```
30
-
31
- To run all tests, simply do:
32
-
33
- ```sh
34
- aiken check
35
- ```
36
-
37
- To run only tests matching the string `foo`, do:
38
-
39
- ```sh
40
- aiken check -m foo
41
- ```
42
-
43
- ## Documentation
44
-
45
- If you're writing a library, you might want to generate an HTML documentation for it.
46
-
47
- Use:
48
-
49
- ```sh
50
- aiken docs
51
- ```
52
-
53
- ## Resources
54
-
55
- Find more on the [Aiken's user manual](https://aiken-lang.org).