-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsmart-wallet-endpoint.clar
More file actions
138 lines (132 loc) · 3.1 KB
/
Copy pathsmart-wallet-endpoint.clar
File metadata and controls
138 lines (132 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
;; title: smart-wallet-endpoint
;; version:
;; summary:
;; description:
(define-constant err-invalid-payload (err u5000))
(use-trait sip-010-token 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
(use-trait wallet-trait .smart-wallet-trait.smart-wallet-trait)
(use-trait extension-trait 'ST3FFRX7C911PZP5RHE148YDVDD9JWVS6FZRA60VS.extension-trait.extension-trait)
(define-public (stx-transfer-sponsored
(sm <wallet-trait>)
(details {
amount: uint,
to: principal,
fees: uint,
})
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call .ext-sponsored-transfer
(unwrap! (to-consensus-buff? details) err-invalid-payload) sig-auth
)
)
(define-public (stx-send-many-sponsored
(sm <wallet-trait>)
(details {
recipients: (list 11 {
ustx: uint,
to: principal,
}),
fees: uint,
})
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call .ext-sponsored-send-many
(unwrap! (to-consensus-buff? details) err-invalid-payload) sig-auth
)
)
(define-public (sbtc-transfer-sponsored
(sm <wallet-trait>)
(details {
amount: uint,
to: principal,
fees: uint,
})
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call .ext-sponsored-sbtc-transfer
(unwrap! (to-consensus-buff? details) err-invalid-payload) sig-auth
)
)
(define-public (sbtc-transfer-many-sponsored
(sm <wallet-trait>)
(details {
recipients: (list 11
{
;; Amount in sats.
a: uint,
;; Recipient address.
r: principal,
}
),
fees: uint,
})
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call .ext-sponsored-sbtc-transfer-many
(unwrap! (to-consensus-buff? details) err-invalid-payload) sig-auth
)
)
(define-public (delegate-stx
(sm <wallet-trait>)
(extension <extension-trait>)
(amount uint)
(to principal)
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call extension
(unwrap!
(to-consensus-buff? {
action: "delegate",
amount-ustx: amount,
delegate-to: to,
until-burn-ht: none,
pox-addr: none,
})
err-invalid-payload
)
sig-auth
)
)
(define-public (revoke-delegate-stx
(sm <wallet-trait>)
(extension <extension-trait>)
(sig-auth (optional {
auth-id: uint,
signature: (buff 64),
pubkey: (buff 33),
}))
)
(contract-call? sm extension-call extension
(unwrap!
(to-consensus-buff? {
action: "revoke",
amount-ustx: u0,
delegate-to: tx-sender,
until-burn-ht: none,
pox-addr: none,
})
err-invalid-payload
)
sig-auth
)
)