# Methods

## Address

The result of each one of the following `address` methods return one or an array of `Address` objects that include the following methods:

* `getAsset`: Returns the `asset` of the `address` `assetCode`.
* `getData`: Returns the `address` details.
* `getWallet`: Returns the `wallet` of the `address` `walletId` if set.

### `address.create`

Creates a new `address`.

**Example:**

#### Request

```javascript
await slyk.address.create({
  address: '1AyzfnxYZPeqgS3j3L5vfnUTkxVZ3FhGMp',
  assetCode: 'btc',
  walletId: '9afa8a2d-023a-4040-b591-c03077f43d23'
});
```

#### Response

```javascript
{
  "address": "1AyzfnxYZPeqgS3j3L5vfnUTkxVZ3FhGMp",
  "assetCode": "btc",
  "customData": {},
  "createdAt": "2019-03-20T14:30:37.483Z",
  "metadata": {},
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "walletId": "9afa8a2d-023a-4040-b591-c03077f43d23"
}
```

### `address.get`

Retrieves the `address` of the given `address`.

**Example:**

#### Request

```javascript
await slyk.address.get('1AyzfnxYZPeqgS3j3L5vfnUTkxVZ3FhGMp');
```

#### Response

```javascript
{
  "address": "1AyzfnxYZPeqgS3j3L5vfnUTkxVZ3FhGMp",
  "assetCode": "btc",
  "customData": {},
  "createdAt": "2019-03-20T14:30:37.483Z",
  "metadata": {},
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "walletId": "9afa8a2d-023a-4040-b591-c03077f43d23"
}
```

### `address.list`

Retrieves a list of `addresses`.

**Example:**

#### Request

```javascript
await slyk.address.list({
  page: { size: 2 },
  sort: [{ name: 'createdAt'}],
  filter: { walletId: '9afa8a2d-023a-4040-b591-c03077f43d23' }
});
```

#### Response

```javascript
{
  "results": [{
    "address": "1AyzfnxYZPeqgS3j3L5vfnUTkxVZ3FhGMp",
    "assetCode": "btc",
    "customData": {},
    "createdAt": "2019-03-20T14:30:37.483Z",
    "metadata": {},
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "9afa8a2d-023a-4040-b591-c03077f43d23"
  },
  {
    "address": "D7SrewuwiEFDtD69L336ADGf6EF2owohLg",
    "assetCode": "doge",
    "customData": {},
    "createdAt": "2019-03-20T14:30:37.483Z",
    "metadata": {},
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "9afa8a2d-023a-4040-b591-c03077f43d23"
  }],
  "total": 32
}
```

## Asset

The result of each one of the following `asset` methods return one or an array of `Asset` objects that include the following methods:

* `getConnection`: Returns the `connection` of the `asset` `connectionId` if set.
* `getData`: Returns the `asset` details.
* `patch`: Patches the `asset`.

### `asset.create`

Creates a new `asset`.

**Example:**

#### Request

```javascript
await slyk.asset.create({
  code: 'bar',
  name: 'Foobar Coin',
  symbol: 'ƒ'
});
```

#### Response

```javascript
{
  "code": "bar",
  "connectionId": null,
  "contract": {},
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "decimalPlaces": 8,
  "enabled": false,
  "logoUrl": null,
  "metadata": {},
  "name": "Foobar coin",
  "symbol": "ƒ",
  "system": false,
  "type": "custom",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `asset.get`

Retrieves the `asset` of the given `code`.

**Example:**

#### Request

```javascript
await slyk.asset.get('bar');
```

#### Response

```javascript
{
  "code": "bar",
  "connectionId": null,
  "contract": {},
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "decimalPlaces": 8,
  "enabled": false,
  "logoUrl": null,
  "metadata": {},
  "name": "Foobar coin",
  "symbol": "ƒ",
  "system": false,
  "type": "custom",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `asset.list`

Retrieves a list of `assets`.

**Example:**

#### Request

```javascript
await slyk.asset.list({
  page: { size: 2 },
  sort: [{ direction: 'desc', name: 'code' }],
  filter: { name: 'foo' }
});
```

#### Response

```javascript
{
  "results": [{
    "code": "bar",
    "connectionId": null,
    "contract": {},
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "decimalPlaces": 8,
    "enabled": false,
    "logoUrl": null,
    "metadata": {},
    "name": "Foobar coin",
    "symbol": "ƒ",
    "system": false,
    "type": "custom",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "code": "biz",
    "connectionId": null,
    "contract": {},
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "decimalPlaces": 8,
    "enabled": false,
    "logoUrl": null,
    "metadata": {},
    "name": "Foobiz coin",
    "symbol": "Ɓ",
    "system": false,
    "type": "custom",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 32
}
```

### `asset.patch`

Modifies the details the `asset` of the given `code`.

**Example:**

#### Request

```javascript
await slyk.asset.patch('bar' { customData: { qux: 'quux' } });
```

#### Response

```javascript
{
  "code": "bar",
  "connectionId": null,
  "contract": {},
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": { "qux": "quux" },
  "decimalPlaces": 8,
  "enabled": false,
  "logoUrl": null,
  "metadata": {},
  "name": "Foobar coin",
  "symbol": "ƒ",
  "system": false,
  "type": "custom",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

## Invite

The result of each one of the following `invite` methods return one or an array of `Invite` objects that include the following methods:

* `cancel`: Cancels the `invite`.
* `getData`: Returns the `invite` details.
* `getInvitedUser`: Returns the `user` of the `invite` `invitedUserId` if set.
* `getInviterUser`: Returns the `user` of the `invite` `inviterUserId` if set.
* `validate`: Validates the `invite`.

### `invite.cancel`

Cancels the `invite` of the given `code`.

**Example:**

#### Request

```javascript
await slyk.invite.cancel('447fcf25-4e70-47a0-a2ad-a8f0aadf5a91');
```

#### Response

```javascript
true
```

### `invite.create`

Creates a new `invite`.

**Example:**

#### Request

```javascript
await slyk.invite.create({ 
    email: 'foo@bar.com', 
    inviterUserId: '26b7d8c3-d21c-420b-9820-9e8b822b90d2' 
});
```

#### Response

```javascript
{
  "code": "447fcf25-4e70-47a0-a2ad-a8f0aadf5a91",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "expiredAt": "2019-04-20T14:30:37.483Z",
  "invitedEmail": "foo@bar.com",
  "invitedUserId": null,
  "inviterUserId": "26b7d8c3-d21c-420b-9820-9e8b822b90d2",
  "status": "pending",
  "updatedAt": "2019-03-20T14:30:37.483Z",
}
```

### `invite.get`

Retrieves the `invite` of the given `code`.

**Example:**

#### Request

```javascript
await slyk.invite.get('447fcf25-4e70-47a0-a2ad-a8f0aadf5a91');
```

#### Response

```javascript
{
  "code": "447fcf25-4e70-47a0-a2ad-a8f0aadf5a91",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "expiredAt": "2019-04-20T14:30:37.483Z",
  "invitedEmail": "foo@bar.com",
  "invitedUserId": null,
  "inviterUserId": "26b7d8c3-d21c-420b-9820-9e8b822b90d2",
  "status": "pending",
  "updatedAt": "2019-03-20T14:30:37.483Z",
}
```

### `invite.list`

Retrieves a list of `invites`.

**Example:**

#### Request

```javascript
await slyk.invite.list({
  page: { size: 2 },
  sort: [{ direction: 'desc', name: 'code' }],
  filter: { invitedEmail: 'foo@bar.com' }
});
```

#### Response

```javascript
{
  "results": [{
    "code": "447fcf25-4e70-47a0-a2ad-a8f0aadf5a91",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "expiredAt": "2019-04-20T14:30:37.483Z",
    "invitedEmail": "foo@bar.com",
    "invitedUserId": null,
    "inviterUserId": "26b7d8c3-d21c-420b-9820-9e8b822b90d2",
    "status": "pending",
    "updatedAt": "2019-03-20T14:30:37.483Z",
  },
  {
    "code": "06b989b9-8808-4615-95ed-da6c15b945d2",
    "createdAt": "2019-01-20T14:30:37.483Z",
    "expiredAt": "2019-02-20T14:30:37.483Z",
    "invitedEmail": "foo@bar.com",
    "invitedUserId": null,
    "inviterUserId": "26b7d8c3-d21c-420b-9820-9e8b822b90d2",
    "status": "expired",
    "updatedAt": "2019-03-20T14:30:37.483Z",
  }],
  "total": 32
}
```

### `invite.send`

Creates and sends a one or multiples `invite`.

**Example:**

#### Request

```javascript
await slyk.invite.send({
  email: ['foo@bar.com', 'foo@biz.com'],
  inviterUserId: '26b7d8c3-d21c-420b-9820-9e8b822b90d2'
});
```

#### Response

```javascript
true
```

### `invite.validate`

Validates the `invite` with the given `code`.

**Example:**

#### Request

```javascript
await slyk.invite.validate('06b989b9-8808-4615-95ed-da6c15b945d2');
```

#### Response

```javascript
{ "referrerName": "corge" }
```

## Movement

The result of each one of the following `movement` methods return one or an array of `Movement` objects that include the following methods:

* `getAsset`: Returns the `asset` of the `movement` `assetCode`.
* `getData`: Returns the `movement` details.
* `getWallet`: Returns the `wallet` of the `movement` `walletId`.
* `getTransaction`: Returns the `transaction` of the `movement` `transactionId`.

### `movement.get`

Returns the `movement` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.movement.get('09900e6e-991e-43bd-9b82-0641f648c1d1');
```

#### Response

```javascript
{
  "amount": "4.50000000",
  "assetCode": "garply",
  "code": "deposit",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
  "transactionId": "43563311-ab16-4499-95d2-30d9e06ba159",
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "walletId": "703d8c69-d8fc-4e02-a7c9-42340ef07727"
}
```

### `movement.list`

Retrieves a list of `movements`.

**Example:**

#### Request

```javascript
await slyk.movement.list({
  inlcude: 'transaction',
  page: { size: 2 },
  filter: { walletId: '703d8c69-d8fc-4e02-a7c9-42340ef07727' }
});
```

#### Response

```javascript
{
  "results": [{
    "amount": "4.50000000",
    "assetCode": "eth",
    "code": "deposit",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
    "transactionId": "43563311-ab16-4499-95d2-30d9e06ba159",
    "transaction": {
      "amount": "4.50000000",
      "assetCode": "eth",
      "code": "internal",
      "createdAt": "2019-03-20T14:30:37.483Z",
      "description": null,
      "destinationAddress": null,
      "destinationWalletId": "703d8c69-d8fc-4e02-a7c9-42340ef07727",
      "externalId": null,
      "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
      "metadata": {},
      "originAddress": null,
      "originWalletId": null,
      "status": "completed",
      "type": "deposit",
      "updatedAt": "2019-03-20T14:30:37.483Z"
    },
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "703d8c69-d8fc-4e02-a7c9-42340ef07727"
  },
  {
    "amount": "-0.50000000",
    "assetCode": "eth",
    "code": "withdrawal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "id": "b9fe22e5-2985-4814-8cb8-02e1cb581001",
    "transactionId": "a3293366-0d4c-4f83-8f71-84fe0b7dda99",
    "transaction": {
      "amount": "4.50000000",
      "assetCode": "eth",
      "code": "internal",
      "createdAt": "2019-03-20T14:30:37.483Z",
      "description": null,
      "destinationAddress": null,
      "destinationWalletId": null,
      "externalId": null,
      "id": "b9fe22e5-2985-4814-8cb8-02e1cb581001",
      "metadata": {},
      "originAddress": null,
      "originWalletId": "703d8c69-d8fc-4e02-a7c9-42340ef07727",
      "status": "completed",
      "type": "withdrawal",
      "updatedAt": "2019-03-20T14:30:37.483Z"
    },
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "703d8c69-d8fc-4e02-a7c9-42340ef07727"
  }],
  "total": 4
}
```

## Payment Method

### `paymentMethod.get`

Returns the `paymentMethod` of the given `slug`.

* `getData`: Returns the `paymentMethod` details.

**Example:**

#### Request

```javascript
await slyk.paymentMethod.get('paypal');
```

#### Response

```javascript
{
  "assets": ["eur", "usd"],
  "capabilities": ["deposit"],
  "createdAt": "2019-03-20T14:30:37.483Z",
  "enabled": true,
  "features": ["apm"],
  "metadata": {
    "clientId": "client-id",
    "secret": "12345*****"
  },
  "name": "Paypal",
  "slug": "paypal"
}
```

### `paymentMethod.list`

Retrieves a list of `paymentMethod`.

**Example:**

#### Request

```javascript
await slyk.movement.list({ filter: { enabled: true } });
```

#### Response

```javascript
{
  "results": [{
    "assets": ["eur", "usd"],
    "capabilities": ["deposit"],
    "createdAt": "2019-03-20T14:30:37.483Z",
    "enabled": true,
    "features": ["apm"],
    "metadata": {
      "clientId": "client-id",
      "secret": "12345*****"
    },
    "name": "Paypal",
    "slug": "paypal"
  },
  {
    "assets": ["eur", "usd"],
    "capabilities": ["deposit"],
    "createdAt": "2019-03-20T14:30:37.483Z",
    "enabled": true,
    "features": ["apm"],
    "metadata": {
      "apiPublishableKey": "api-publishable-key",
      "apiSecretKey": "12345*****"
    },
    "name": "Stripe",
    "slug": "stripe"
  }],
  "total": 4
}
```

## Rate

The result of each one of the following `rate` methods return one or an array of `Rate` objects that include the following methods:

* `getBaseAsset`: Returns the `asset` of the `rate` `baseAssetCode`.
* `getData`: Returns the `rate` details.
* `getQuoteAsset`: Returns the `asset` of the `rate` `quoteAssetCode`.
* `patch`: Patches the `rate`.

### `rate.create`

Creates a new `rate`.

**Example:**

#### Request

```javascript
await slyk.rate.create({
  baseAssetCode: 'btc',
  quoteAssetCode: 'usd',
  rate: '6649.88'
});
```

#### Response

```javascript
{
  "baseAssetCode": "btc",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "metadata": {},
  "quoteAssetCode": "usd",
  "rate": "6649.88000000",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `rate.delete`

Deletes the `rate` of the given `baseAssetCode` and `quoteAssetCode`.

**Example:**

#### Request

```javascript
await slyk.rate.delete('btc', 'usd');
```

#### Response

```javascript
true
```

### `rate.get`

Retrieves the `rate` of the given `baseAssetCode` and `quoteAssetCode`.

**Example:**

#### Request

```javascript
await slyk.rate.get('garply', 'eur');
```

#### Response

```javascript
{
  "baseAssetCode": "btc",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "metadata": {},
  "quoteAssetCode": "eur",
  "rate": "6079.25000000",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `rate.list`

Retrieves a list of `rates`.

**Example:**

#### Request

```javascript
await slyk.rate.list({ filter: { assetCode: 'btc' } });
```

#### Response

```javascript
{
  "results": [{
    "baseAssetCode": "btc",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "metadata": {},
    "quoteAssetCode": "eur",
    "rate": "6079.25000000",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "baseAssetCode": "btc",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "metadata": {},
    "quoteAssetCode": "usd",
    "rate": "6649.88000000",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 2
}
```

### `rate.patch`

Modifies the details the `rate` of the given `baseAssetCode` and `quoteAssetCode`.

**Example:**

#### Request

```javascript
await slyk.rate.patch('eth', 'usd', { rate: '137.18' });
```

#### Response

```javascript
{
  "baseAssetCode": "eth",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "metadata": {},
  "quoteAssetCode": "usd",
  "rate": "137.18000000",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

## Transaction

The result of each one of the following `transaction` methods return one or an array of `Transaction` objects that include the following methods:

* `approve`: Approves the `transaction`.
* `confirm`: Confirms the `transaction`.
* `fail`: Fails the `transaction`.
* `getAsset`: Returns the `asset` of the `transaction` `assetCode`.
* `getData`: Returns the `transaction` details.
* `getDestinationAddress`: Returns the `address` of the `transaction` `destinationAddress` if set.
* `getDestinationWallet`: Returns the `wallet` of the `transaction` `destinationWalletId` if set.
* `getOriginAddress`: Returns the `address` of the `transaction` `originAddress` if set.
* `getOriginWallet`: Returns the `wallet` of the `transaction` `originWalletId` if set.
* `getMovements`: Returns the related `movements`.
* `reject`: Rejects the `transaction`.

### `transaction.approve`

Approves the `transaction` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.transaction.approve('43563311-ab16-4499-95d2-30d9e06ba159');
```

#### Response

```javascript
{
  "amount": "5.00000000",
  "assetCode": "eth",
  "code": "internal",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": null,
  "externalId": null,
  "externalReference": null,
  "id": "43563311-ab16-4499-95d2-30d9e06ba159",
  "metadata": {},
  "originAddress": "0x1B8D75764ee27D06b131728412BfdF36f94dcbc1",
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "processing",
  "type": "withdrawal",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.confirm`

Confirms the `transaction` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.transaction.confirm('43563311-ab16-4499-95d2-30d9e06ba159');
```

#### Response

```javascript
{
  "amount": "5.00000000",
  "assetCode": "eth",
  "code": "internal",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": null,
  "externalId": null,
  "externalReference": null,
  "id": "43563311-ab16-4499-95d2-30d9e06ba159",
  "metadata": {},
  "originAddress": "0x1B8D75764ee27D06b131728412BfdF36f94dcbc1",
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "completed",
  "type": "withdrawal",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.deposit`

Creates a new `deposit` `transaction`.

**Example:**

#### Request

```javascript
await slyk.transaction.deposit({
  amount: '25.5',
  assetCode: 'bar',
  code: 'internal',
  destinationWalletId: '1ef0452a-062c-45ce-aaf5-dd19e38c7711'
});
```

#### Response

```javascript
{
  "amount": "25.50000000",
  "assetCode": "bar",
  "code": "internal",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "externalId": null,
  "externalReference": null,
  "id": "3110c2e3-28c6-463f-a69b-174527eabd70",
  "metadata": {},
  "originAddress": null,
  "originWalletId": null,
  "processedAt": null,
  "reference": null,
  "status": "pending",
  "type": "deposit",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.fail`

Fails the `transaction` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.transaction.fail('3110c2e3-28c6-463f-a69b-174527eabd70', { reason: 'Wrong amount.' });
```

#### Response

```javascript
{
  "amount": "25.50000000",
  "assetCode": "bar",
  "code": "internal",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "externalId": null,
  "externalReference": null,
  "id": "3110c2e3-28c6-463f-a69b-174527eabd70",
  "metadata": { "failReason": "Wrong amount." },
  "originAddress": null,
  "originWalletId": null,
  "processedAt": null,
  "reference": null,
  "status": "failed",
  "type": "deposit",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.get`

Returns the `transaction` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.transaction.get('a33a1c4d-b4a1-4ea3-b57a-25b485b4e5a5');
```

#### Response

```javascript
{
  "amount": "0.50000000",
  "assetCode": "eth",
  "code": "crypto:coinbase",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": "0x1B8D75764ee27D06b131728412BfdF36f94dcbc1",
  "destinationWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "externalId": null,
  "externalReference": null,
  "id": "a33a1c4d-b4a1-4ea3-b57a-25b485b4e5a5",
  "metadata": {},
  "originAddress": null,
  "originWalletId": null,
  "processedAt": null,
  "reference": null,
  "status": "pending",
  "type": "deposit",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.list`

Retrieves a list of `transactions`.

**Example:**

#### Request

```javascript
await slyk.movement.list({ filter: { walletId: '1ef0452a-062c-45ce-aaf5-dd19e38c7711' } });
```

#### Response

```javascript
{
  "results": [{
    "amount": "0.50000000",
    "assetCode": "eth",
    "code": "crypto:coinbase",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": "0x1B8D75764ee27D06b131728412BfdF36f94dcbc1",
    "destinationWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "externalId": null,
    "externalReference": null,
    "id": "a33a1c4d-b4a1-4ea3-b57a-25b485b4e5a5",
    "metadata": {},
    "originAddress": null,
    "originWalletId": null,
    "processedAt": null,
    "reference": null,
    "status": "pending",
    "type": "deposit",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "amount": "250.00000000",
    "assetCode": "usd",
    "code": "bank:wire",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": null,
    "externalId": null,
    "externalReference": null,
    "id": "43563311-ab16-4499-95d2-30d9e06ba159",
    "metadata": {},
    "originAddress": null,
    "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "processedAt": null,
    "reference": null,
    "status": "pending",
    "type": "withdrawal",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 2
}
```

### `transaction.pay`

Creates a new `pay` `transaction`.

**Example:**

#### Request

```javascript
await slyk.transaction.pay({
  amount: '0.05',
  assetCode: 'eth',
  originWalletId: '1ef0452a-062c-45ce-aaf5-dd19e38c7711'
});
```

#### Response

```javascript
{
  "amount": "0.05000000",
  "assetCode": "eth",
  "code": "internal:pay",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": "c4004a9d-6f2a-47b5-8c1e-d6349951ad05",
  "externalId": null,
  "externalReference": null,
  "id": "43563311-ab16-4499-95d2-30d9e06ba159",
  "metadata": {},
  "originAddress": null,
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "pending",
  "type": "transfer",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.reject`

Rejects the `transaction` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.transaction.reject('77d3a33c-89ed-4e1b-afd3-f726a0a3430a', { reason: { qux: 'quux' } });
```

#### Response

```javascript
{
  "amount": "175.00000000",
  "assetCode": "eur",
  "code": "bank:wire",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": null,
  "externalId": null,
  "externalReference": null,
  "id": "77d3a33c-89ed-4e1b-afd3-f726a0a3430a",
  "metadata": { "rejectReason": { "qux": "quux" } },
  "originAddress": null,
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "rejected",
  "type": "withdrawal",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.transfer`

Creates a new `transfer` `transaction`.

**Example:**

#### Request

```javascript
await slyk.transaction.transfer({
  amount: '0.5',
  assetCode: 'eth',
  code: 'internal',
  commit: true,
  destinationWalletId: 'ab7970fb-a1a9-456e-a6b2-1fedfba2247b',
  originWalletId: '1ef0452a-062c-45ce-aaf5-dd19e38c7711',
});
```

#### Response

```javascript
{
  "amount": "0.50000000",
  "assetCode": "eth",
  "code": "internal",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": "ab7970fb-a1a9-456e-a6b2-1fedfba2247b",
  "externalId": null,
  "externalReference": null,
  "id": "43563311-ab16-4499-95d2-30d9e06ba159",
  "metadata": {},
  "originAddress": null,
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "pending",
  "type": "transfer",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `transaction.withdrawal`

Creates a new `withdrawal` `transaction`.

**Example:**

#### Request

```javascript
await slyk.transaction.withdrawal({
  amount: '200',
  assetCode: 'eur',
  code: 'bank:wire',
  commit: true,
  originWalletId: '1ef0452a-062c-45ce-aaf5-dd19e38c7711',
});
```

#### Response

```javascript
{
  "amount": "200.00000000",
  "assetCode": "eur",
  "code": "bank:wire",
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "description": null,
  "destinationAddress": null,
  "destinationWalletId": null,
  "externalId": null,
  "externalReference": null,
  "id": "43563311-ab16-4499-95d2-30d9e06ba159",
  "metadata": {},
  "originAddress": null,
  "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
  "processedAt": null,
  "reference": null,
  "status": "pending",
  "type": "withdrawal",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

## User

The result of each one of the following `user` methods return one or an array of `User` objects that include the following methods:

* `approve`: Approves the `user`.
* `block`: Blocks the `user`.
* `changePassword`: Changes the `user` the password.
* `getData`: Returns the `user` details.
* `getInvites`: Returns the `invites` of the `user`.
* `getWallets`: Returns the `wallets` of the `user`.
* `getPrimaryWallet`: Returns the `wallet` of the `user` `primaryWalletId`.
* `getReferralUser`: Returns the `user` of the `user` `referralUserId` if set.
* `patch`: Patches the `user`.
* `unblock`: Unblocks the `user`.

### `user.approve`

Approves the `user` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.user.approve('5e101529-fa30-4415-9945-6540e70c4483');
```

#### Response

```javascript
{
  "approved": true,
  "blocked": false,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": { "qux": "quux" },
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "foobar",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

### `user.block`

Blocks the `user` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.user.block('5e101529-fa30-4415-9945-6540e70c4483');
```

#### Response

```javascript
{
  "approved": false,
  "blocked": true,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": { "qux": "quux" },
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "foobar",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

### `user.changePassword`

Changes the `user` password.

**Example:**

#### Request

```javascript
await slyk.user.changePassword('5e101529-fa30-4415-9945-6540e70c4483', { password: 'waldo' });
```

#### Response

```javascript
true
```

### `user.create`

Creates a new `user`.

**Example:**

#### Request

```javascript
await slyk.user.create({ email: 'foo@bar.com', password: 'waldo' });
```

#### Response

```javascript
{
  "approved": false,
  "blocked": false,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "foobar",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

### `user.get`

Returns the `user` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.user.get('5e101529-fa30-4415-9945-6540e70c4483');
```

#### Response

```javascript
{
  "approved": false,
  "blocked": false,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "foobar",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

### `user.list`

Retrieves a list of `user`.

**Example:**

#### Request

```javascript
await slyk.user.list({ filter: { name: 'foo' } });
```

#### Response

```javascript
{
  "results": [{
    "approved": false,
    "blocked": false,
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "email": "foo@bar.com",
    "id": "5e101529-fa30-4415-9945-6540e70c4483",
    "locale": "en-us",
    "name": "foobar",
    "phone": null,
    "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
    "referralCode": "XYZZY",
    "referralUserId": null,
    "roles": ["user"],
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "verified": false
  },
  {
    "approved": false,
    "blocked": false,
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "email": "foo@biz.com",
    "id": "6173fe23-1442-4003-bc4d-d18f5f42c024",
    "locale": "en-us",
    "name": "foobiz",
    "phone": null,
    "primaryWalletId": "a12fb051-9e36-441a-82b8-90f7813c5504",
    "referralCode": "XYZZY",
    "referralUserId": null,
    "roles": ["user"],
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "verified": false
  }],
  "total": 2
}
```

### `user.patch`

Patches the details of the `user` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.user.patch('5e101529-fa30-4415-9945-6540e70c4483', { name: 'corge' });
```

#### Response

```javascript
{
  "approved": false,
  "blocked": false,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "corge",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

### `user.unblock`

Unblocks the `user` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.user.unblock('5e101529-fa30-4415-9945-6540e70c4483');
```

#### Response

```javascript
{
  "approved": false,
  "blocked": false,
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": { "qux": "quux" },
  "email": "foo@bar.com",
  "id": "5e101529-fa30-4415-9945-6540e70c4483",
  "locale": "en-us",
  "name": "foobar",
  "phone": null,
  "primaryWalletId": "6c455aa8-c714-4441-97a8-0739fe387a67",
  "referralCode": "XYZZY",
  "referralUserId": null,
  "roles": ["user"],
  "updatedAt": "2019-03-20T14:30:37.483Z",
  "verified": false
}
```

## Wallet

The result of each one of the following `wallet` methods return one or an array of `Wallet` objects that include the following methods:

* `getActivity`: Returns the `activity`.
* `getBalance`: Returns the `balance`.
* `getData`: Returns the `wallet` details.
* `getMovements`: Returns the `movements`.
* `getTransactions`: Returns the `transactions`.
* `getOwner`: Returns the `user` of the `wallet` `ownerId`.
* `patch`: Patches the `wallet`.

### `wallet.activity`

Returns the `activity` of the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.activity('2d9b72c5-fbb2-45f1-8591-329c2a014c43', { page: { number: 2, size: 2 } });
```

#### Response

```javascript
{
  "results": [{
    "amount": "5.00000000",
    "assetCode": "garply",
    "code": "internal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "externalId": null,
    "externalReference": null,
    "id": "43563311-ab16-4499-95d2-30d9e06ba159",
    "metadata": {},
    "originAddress": null,
    "originWalletId": null,
    "processedAt": null,
    "reference": null,
    "status": "completed",
    "type": "deposit",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "amount": "2.50000000",
    "assetCode": "garply",
    "code": "bank:wire",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": null,
    "externalId": null,
    "externalReference": null,
    "id": "43563311-ab16-4499-95d2-30d9e06ba159",
    "metadata": {},
    "originAddress": null,
    "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "processedAt": null,
    "reference": null,
    "status": "processing",
    "type": "withdrawal",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 5
}
```

### `wallet.balance`

Returns the `balance` of the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.balance('2d9b72c5-fbb2-45f1-8591-329c2a014c43', { filter: { assetCode: 'in:garply,corge' } });
```

#### Response

```javascript
[
  { "amount": "2.50000000", "assetCode": "coreg" },
  { "amount": "0.50000000", "assetCode": "garply" }
]
```

### `wallet.create`

Creates a new `wallet`.

**Example:**

#### Request

```javascript
await slyk.wallet.create({ ownerId: '0adb8aa9-6232-48f2-8faa-d9289e9134b9' });
```

#### Response

```javascript
{
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "id": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
  "locked": false,
  "metadata": {},
  "name": null,
  "ownerId": null,
  "reference": "XYZZY",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `wallet.get`

Returns the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.get('4b1a22bf-642c-4c4f-bfb4-678e59121e74');
```

#### Response

```javascript
{
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": {},
  "id": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
  "locked": false,
  "metadata": {},
  "name": null,
  "ownerId": null,
  "reference": "XYZZY",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `wallet.globalActivity`

Returns the `globalActivity`.

**Example:**

#### Request

```javascript
await slyk.wallet.globalActivity({ page: { number: 2, size: 2 } });
```

#### Response

```javascript
{
  "results": [{
    "amount": "5.00000000",
    "assetCode": "garply",
    "code": "internal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
    "externalId": null,
    "externalReference": null,
    "id": "43563311-ab16-4499-95d2-30d9e06ba159",
    "metadata": {},
    "originAddress": null,
    "originWalletId": null,
    "processedAt": null,
    "reference": null,
    "status": "completed",
    "type": "deposit",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "amount": "2.50000000",
    "assetCode": "garply",
    "code": "bank:wire",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": null,
    "externalId": null,
    "externalReference": null,
    "id": "43563311-ab16-4499-95d2-30d9e06ba159",
    "metadata": {},
    "originAddress": null,
    "originWalletId": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "processedAt": null,
    "reference": null,
    "status": "processing",
    "type": "withdrawal",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 5
}
```

### `wallet.globalBalance`

Returns the `globalBalance`.

**Example:**

#### Request

```javascript
await slyk.wallet.globalBalance({ filter: { assetCode: 'in:garply,corge' } });
```

#### Response

```javascript
[
  { "amount": "20.00000000", "assetCode": "coreg" },
  { "amount": "15.50000000", "assetCode": "garply" }
]
```

### `wallet.list`

Returns a list `wallet`.

**Example:**

#### Request

```javascript
await slyk.wallet.list({ filter: { locked: true } });
```

#### Response

```javascript
{
  "results": [{
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "id": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
    "locked": true,
    "metadata": {},
    "name": null,
    "ownerId": null,
    "reference": "XYZZY",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "createdAt": "2019-03-20T14:30:37.483Z",
    "customData": {},
    "id": "1ef0452a-062c-45ce-aaf5-dd19e38c7711",
    "locked": true,
    "metadata": {},
    "name": null,
    "ownerId": null,
    "reference": "WALDO",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 2
}
```

### `wallet.movements`

Returns the `movments` of the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.movements('4b1a22bf-642c-4c4f-bfb4-678e59121e74', { include: 'transaction' });
```

#### Response

```javascript
{
  "results": [{
    "amount": "4.50000000",
    "assetCode": "garply",
    "code": "deposit",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
    "transactionId": "43563311-ab16-4499-95d2-30d9e06ba159",
    "transaction": {
      "amount": "4.50000000",
      "assetCode": "garply",
      "code": "internal",
      "createdAt": "2019-03-20T14:30:37.483Z",
      "description": null,
      "destinationAddress": null,
      "destinationWalletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
      "externalId": null,
      "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
      "metadata": {},
      "originAddress": null,
      "originWalletId": null,
      "status": "completed",
      "type": "deposit",
      "updatedAt": "2019-03-20T14:30:37.483Z"
    },
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74"
  },
  {
    "amount": "-0.50000000",
    "assetCode": "garply",
    "code": "withdrawal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "id": "b9fe22e5-2985-4814-8cb8-02e1cb581001",
    "transactionId": "a3293366-0d4c-4f83-8f71-84fe0b7dda99",
    "transaction": {
      "amount": "4.50000000",
      "assetCode": "garply",
      "code": "internal",
      "createdAt": "2019-03-20T14:30:37.483Z",
      "description": null,
      "destinationAddress": null,
      "destinationWalletId": null,
      "externalId": null,
      "id": "b9fe22e5-2985-4814-8cb8-02e1cb581001",
      "metadata": {},
      "originAddress": null,
      "originWalletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
      "status": "completed",
      "type": "withdrawal",
      "updatedAt": "2019-03-20T14:30:37.483Z"
    },
    "updatedAt": "2019-03-20T14:30:37.483Z",
    "walletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74"
  }],
  "total": 2
}
```

### `wallet.patch`

Patches the details of the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.patch('4b1a22bf-642c-4c4f-bfb4-678e59121e74', { customData: { qux: 'quux' }, name: 'corge' });
```

#### Response

```javascript
{
  "createdAt": "2019-03-20T14:30:37.483Z",
  "customData": { "qux": "quux" },
  "id": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
  "locked": true,
  "metadata": {},
  "name": "corge",
  "ownerId": null,
  "reference": "XYZZY",
  "updatedAt": "2019-03-20T14:30:37.483Z"
}
```

### `wallet.transactions`

Returns the `transactions` of the `wallet` of the given `id`.

**Example:**

#### Request

```javascript
await slyk.wallet.transactions('4b1a22bf-642c-4c4f-bfb4-678e59121e74';
```

#### Response

```javascript
{
  "results": [{
    "amount": "4.50000000",
    "assetCode": "garply",
    "code": "internal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
    "externalId": null,
    "id": "09900e6e-991e-43bd-9b82-0641f648c1d1",
    "metadata": {},
    "originAddress": null,
    "originWalletId": null,
    "status": "completed",
    "type": "deposit",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  },
  {
    "amount": "4.50000000",
    "assetCode": "garply",
    "code": "internal",
    "createdAt": "2019-03-20T14:30:37.483Z",
    "description": null,
    "destinationAddress": null,
    "destinationWalletId": null,
    "externalId": null,
    "id": "b9fe22e5-2985-4814-8cb8-02e1cb581001",
    "metadata": {},
    "originAddress": null,
    "originWalletId": "4b1a22bf-642c-4c4f-bfb4-678e59121e74",
    "status": "completed",
    "type": "withdrawal",
    "updatedAt": "2019-03-20T14:30:37.483Z"
  }],
  "total": 2
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.slyk.io/slyk/developing-with-slyk/sdks/server-sdk/methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
